问题描述:
RK3399开发板烧录官网提供的ubuntu镜像: Ubuntu 16.04 Server arm64(下载地址:https://www.96boards.org/documentation/consumer/rock/downloads/ubuntu.md.html),
开发板上电运行查看系统根目录容量已使用96%:
root@rock960:~# dfFilesystem 1K-blocks Used Available Use% Mounted on/dev/root 1515376 1353320 67032 96% /devtmpfs 1951660 0 1951660 0% /devtmpfs 1952236 0 1952236 0% /dev/shmtmpfs 1952236 49692 1902544 3% /runtmpfs 5120 0 5120 0% /run/locktmpfs 1952236 0 1952236 0% /sys/fs/cgrouptmpfs 390448 0 390448 0% /run/user/0root@rock960:~#
再查看磁盘容量,32GB eMMC实际可用容量29GB,除去已分区容量还有27.5GB容量未分区:
root@rock960:~# fdisk -l /dev/mmcblk1Disk /dev/mmcblk1: 29.1 GiB, 31268536320 bytes, 61071360 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: gptDisk identifier: F464C417-6F1F-4BF8-A1CE-BDB432A3BD1BDevice Start End Sectors Size Type/dev/mmcblk1p1 64 8063 8000 3.9M Linux filesystem/dev/mmcblk1p2 16384 24575 8192 4M Linux filesystem/dev/mmcblk1p3 24576 32767 8192 4M Linux filesystem/dev/mmcblk1p4 32768 262143 229376 112M EFI System/dev/mmcblk1p5 262144 3409886 3147743 1.5G Linux filesystemroot@rock960:~#
因此需要把未分区的27.5GB磁盘空间追加到/dev/mmcblk1p5并扩容rootfs文件系统。解决方法主要用到两个命令:parted和resize2fs。
首先重新分配/dev/mmcblk1p5分区大小到覆盖整个磁盘剩余容量:(注意fdisk不支持GPT分区)
root@rock960:~# parted /dev/mmcblk1GNU Parted 3.2Using /dev/mmcblk1Welcome to GNU Parted! Type 'help' to view a list of commands.(parted) print Model: MMC BJNB4R (sd/mmc)Disk /dev/mmcblk1: 31.3GBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags: Number Start End Size File system Name Flags 1 32.8kB 4129kB 4096kB loader1 2 8389kB 12.6MB 4194kB loader2 3 12.6MB 16.8MB 4194kB trust 4 16.8MB 134MB 117MB fat16 boot boot, esp 5 134MB 1746MB 1612MB ext4 rootfs(parted) unit s (parted) print Model: MMC BJNB4R (sd/mmc)Disk /dev/mmcblk1: 61071360sSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags: Number Start End Size File system Name Flags 1 64s 8063s 8000s loader1 2 16384s 24575s 8192s loader2 3 24576s 32767s 8192s trust 4 32768s 262143s 229376s fat16 boot boot, esp 5 262144s 3409886s 3147743s ext4 rootfs (parted) resizepart 5 100% (parted) printModel: MMC BJNB4R (sd/mmc)Disk /dev/mmcblk1: 61071360sSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags: Number Start End Size File system Name Flags 1 64s 8063s 8000s loader1 2 16384s 24575s 8192s loader2 3 24576s 32767s 8192s trust 4 32768s 262143s 229376s fat16 boot boot, esp 5 262144s 61071326s 60809183s ext4 rootfs (parted) Q root@rock960:~#
然后进行EXT文件系统扩容:
root@rock960:~# resize2fs /dev/mmcblk1p5resize2fs 1.42.13 (17-May-2015)The filesystem is already 7601147 (4k) blocks long. Nothing to do!root@rock960:~#
这时查看根目录下已使用容量已经变成5%
root@rock960:~# df -THFilesystem Type Size Used Avail Use% Mounted on/dev/root ext4 31G 1.4G 28G 5% /devtmpfs devtmpfs 2.0G 0 2.0G 0% /devtmpfs tmpfs 2.0G 0 2.0G 0% /dev/shmtmpfs tmpfs 2.0G 51M 2.0G 3% /runtmpfs tmpfs 5.3M 0 5.3M 0% /run/locktmpfs tmpfs 2.0G 0 2.0G 0% /sys/fs/cgrouptmpfs tmpfs 400M 0 400M 0% /run/user/0root@rock960:~#
后续:
TBD
联系客服