瑞芯微ROCK960 RK3399烧录image后扩容rootfs

问题描述:

瑞芯微ROCK960 RK3399烧录image后扩容rootfs_第1张图片

RK3399开发板烧录官网提供的ubuntu镜像: Ubuntu 16.04 Server arm64(下载地址:https://www.96boards.org/documentation/consumer/rock/downloads/ubuntu.md.html),

开发板上电运行查看系统根目录容量已使用96%:

root@rock960:~# df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root        1515376 1353320     67032  96% /
devtmpfs         1951660       0   1951660   0% /dev
tmpfs            1952236       0   1952236   0% /dev/shm
tmpfs            1952236   49692   1902544   3% /run
tmpfs               5120       0      5120   0% /run/lock
tmpfs            1952236       0   1952236   0% /sys/fs/cgroup
tmpfs             390448       0    390448   0% /run/user/0

root@rock960:~# 

 

再查看磁盘容量,32GB eMMC实际可用容量29GB,除去已分区容量还有27.5GB容量未分区:

root@rock960:~# fdisk -l /dev/mmcblk1
Disk /dev/mmcblk1: 29.1 GiB, 31268536320 bytes, 61071360 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: F464C417-6F1F-4BF8-A1CE-BDB432A3BD1B

Device           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 filesystem
root@rock960:~# 

 

因此需要把未分区的27.5GB磁盘空间追加到/dev/mmcblk1p5并扩容rootfs文件系统。解决方法主要用到两个命令:parted和resize2fs。

首先重新分配/dev/mmcblk1p5分区大小到覆盖整个磁盘剩余容量:(注意fdisk不支持GPT分区)

root@rock960:~# parted /dev/mmcblk1
GNU Parted 3.2
Using /dev/mmcblk1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Model: MMC BJNB4R (sd/mmc)
Disk /dev/mmcblk1: 31.3GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk 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: 61071360s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk 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) print
Model: MMC BJNB4R (sd/mmc)
Disk /dev/mmcblk1: 61071360s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk 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/mmcblk1p5
resize2fs 1.42.13 (17-May-2015)
The filesystem is already 7601147 (4k) blocks long.  Nothing to do!
root@rock960:~# 

 

这时查看根目录下已使用容量已经变成5%

root@rock960:~# df -TH
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/root      ext4       31G  1.4G   28G   5% /
devtmpfs       devtmpfs  2.0G     0  2.0G   0% /dev
tmpfs          tmpfs     2.0G     0  2.0G   0% /dev/shm
tmpfs          tmpfs     2.0G   51M  2.0G   3% /run
tmpfs          tmpfs     5.3M     0  5.3M   0% /run/lock
tmpfs          tmpfs     2.0G     0  2.0G   0% /sys/fs/cgroup
tmpfs          tmpfs     400M     0  400M   0% /run/user/0
root@rock960:~# 

 

后续:

TBD

 

转载于:https://www.cnblogs.com/garrettpan/p/9675633.html

你可能感兴趣的:(瑞芯微ROCK960 RK3399烧录image后扩容rootfs)