Sep 26, 2022, 11:51 AM

Ubuntu22.04挂载扩容Cool-PI-4B(eMMC 32GB)

Ubuntu22.04 默认更新系统后,只有8GB空间,以下进行扩容,使用100%空间

  • 更新前的容量如下:
ubuntu@coolpi:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           372M  4.0M  368M   2% /run
/dev/mmcblk0p2  6.4G  5.4G  704M  89% /
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           372M  124K  372M   1% /run/user/1000

ubuntu@coolpi:~$ sudo fdisk -l
[sudo] password for ubuntu: 
Disk /dev/ram0: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mmcblk0: 29.12 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: dos
Disk identifier: 0x6380c172

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1        2048   616447   614400  300M  b W95 FAT32
/dev/mmcblk0p2      616448 14335999 13719552  6.5G 83 Linux
  • 采用parted命令进行扩容
ubuntu@coolpi:~$ sudo parted /dev/mmcblk0 
GNU Parted 3.4
Using /dev/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
  • 输入resizepart进行重新分配空间,并退出
(parted) resizepart                                                       
Partition number? 2                                                       
Warning: Partition /dev/mmcblk0p2 is being used. Are you sure you want to continue?
Yes/No? YES                                                               
End?  [7340MB]? 100% 
(parted) quit 
  • 重启系统
ubuntu@coolpi:~$ sudo reboot
  • 查看更新后的容量
ubuntu@coolpi:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           372M  3.9M  368M   2% /run
/dev/mmcblk0p2   29G  5.4G   22G  20% /
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           372M   88K  372M   1% /run/user/126
tmpfs           372M   88K  372M   1% /run/user/1000

ubuntu@coolpi:~$ sudo fdisk -l
[sudo] password for ubuntu: 
Disk /dev/ram0: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mmcblk0: 29.12 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: dos
Disk identifier: 0x6da91944

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1        2048   616447   614400  300M  b W95 FAT32
/dev/mmcblk0p2      616448 61071359 60454912 28.8G 83 Linux