运行在树莓派上的NextCloud突然不能用了,登录上系统发现32G的SD卡已经没有空间了,所以找了一个64G的SD卡,然后通过Win32DiskImager将32G卡内容读取出来,再将Image写入64G SD卡(我用的balenaEtcher),待写完之后运行查看系统空间:
pi@raspbian:~$ df -hFilesystem Size Used Avail Use% Mounted on/dev/root 29G 28G 116M 100%devtmpfs 1.9G 0 1.9G 0% devtmpfs 1.9G 0 1.9G 0% dev/shmtmpfs 1.9G 11M 1.9G 1% runtmpfs 5.0M 0 5.0M 0% run/locktmpfs 1.9G 0 1.9G 0% sys/fs/cgroup/dev/mmcblk0p1 252M 75M 178M 30% boottmpfs 385M 0 385M 0% run/user/1000
发现空间还是32G,因为还需要进行以下扩容操作:
cat /sys/block/mmcblk0/mmcblk0p2/start
记录起始位置 (532480)
fdisk /dev/mmcblk0Command (m for help): dPartition number (1,2, default 2): 2Partition 2 has been deleted.Command (m for help): nPartition typep primary (1 primary, 0 extended, 3 free)e extended (container for logical partitions)Select (default p): pPartition number (2-4, default 2): 2First sector (2048-31116287, default 2048): 532480 (上边记录的起始位置)Last sector, +/-sectors or +/-size{K,M,G,T,P} (532480-31116287, default 31116287): (这里回车默认即可)Created a new partition 2 of type 'Linux' and of size 14.6 GiB.Partition #2 contains a ext4 signature.Do you want to remove the signature? [Y]es/[N]o: nCommand (m for help): wThe partition table has been altered.Syncing disks.
fdisk /dev/mmcblk0reboot
磁盘更新
resize2fs /dev/mmcblk0p2
pi@raspbian:~$ df -hFilesystem Size Used Avail Use% Mounted on/dev/root 59G 28G 29G 50% /devtmpfs 1.9G 0 1.9G 0% /devtmpfs 1.9G 0 1.9G 0% /dev/shmtmpfs 1.9G 11M 1.9G 1% /runtmpfs 5.0M 0 5.0M 0% /run/locktmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup/dev/mmcblk0p1 252M 75M 178M 30% /boottmpfs 385M 0 385M 0% /run/user/1000
文章转载自嵌入式IoT笔记,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




