Note where home is
(RaspberryPi2)root@localhost:~# df -h /home/
Filesystem Size Used Avail Use% Mounted on
/dev/mmcblk0p4 1.6G 1.3G 160M 89% /oem
(RaspberryPi2)root@localhost:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 451M 0 451M 0% /dev
tmpfs 93M 13M 80M 14% /run
/dev/disk/by-label/system-a 976M 238M 672M 27% /
/dev/mmcblk0p4 1.6G 1.3G 160M 89% /oem
tmpfs 463M 4.0K 463M 1% /etc/fstab
tmpfs 463M 112K 463M 1% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 463M 0 463M 0% /sys/fs/cgroup
tmpfs 463M 0 463M 0% /mnt
tmpfs 463M 0 463M 0% /tmp
tmpfs 463M 0 463M 0% /var/lib/sudo
/dev/mmcblk0p1 63M 43M 21M 68% /boot/uboot
cgmfs 100K 0 100K 0% /run/cgmanager/fs
/dev/mmcblk0p3 976M 238M 672M 27% /writable/cache/system
tmpfs 93M 0 93M 0% /run/user/1000
Run fdisk, stripping away the p4
(RaspberryPi2)root@localhost:~# sudo fdisk -uc /dev/mmcblk0
Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
p
for partition
Command (m for help): p
Disk /dev/mmcblk0: 29.7 GiB, 31914983424 bytes, 62333952 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: 0x000095e1
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 8192 139263 131072 64M c W95 FAT32 (LBA)
/dev/mmcblk0p2 139264 2236415 2097152 1G 83 Linux
/dev/mmcblk0p3 2236416 4333567 2097152 1G 83 Linux
/dev/mmcblk0p4 4333568 7616511 3282944 1.6G 83 Linux
d
for delete
Command (m for help): d
pick number 4
Partition number (1-4, default 4): 4
Partition 4 has been deleted.
create a new partition with n
Command (m for help): n
Partition type
p primary (3 primary, 0 extended, 1 free)
e extended (container for logical partitions)
its a primary p
, then pick the Start
sector from /dev/mmcblk0p4
from the result of running p
above and use it as First sector
value. Hit for the Last sector
to pick its default value (the rest of the card)
Select (default e): p
Selected partition 4
First sector (2048-62333951, default 2048): 4333568
Last sector, +sectors or +size{K,M,G,T,P} (4333568-62333951, default 62333951):
Created a new partition 4 of type 'Linux' and of size 27.7 GiB.
w
to write it back
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
reboot
(RaspberryPi2)root@localhost:~# shutdown -r now
wait for it to come back up, still shows the same
RaspberryPi2)ubuntu@localhost:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 451M 0 451M 0% /dev
tmpfs 93M 13M 81M 14% /run
/dev/disk/by-label/system-a 976M 238M 672M 27% /
/dev/mmcblk0p4 1.6G 1.3G 160M 89% /oem
tmpfs 463M 4.0K 463M 1% /etc/fstab
tmpfs 463M 0 463M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 463M 0 463M 0% /sys/fs/cgroup
tmpfs 463M 0 463M 0% /tmp
tmpfs 463M 0 463M 0% /mnt
tmpfs 463M 0 463M 0% /var/lib/sudo
/dev/mmcblk0p1 63M 43M 21M 68% /boot/uboot
cgmfs 100K 0 100K 0% /run/cgmanager/fs
/dev/mmcblk0p3 976M 238M 672M 27% /writable/cache/system
tmpfs 93M 0 93M 0% /run/user/1000
go root
(RaspberryPi2)ubuntu@localhost:~$ sudo su -
resize p4
to fit the disk
(RaspberryPi2)root@localhost:~# resize2fs -p /dev/mmcblk0p4
resize2fs 1.42.12 (29-Aug-2014)
Filesystem at /dev/mmcblk0p4 is mounted on /writable; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/mmcblk0p4 is now 7250048 (4k) blocks long.
bam, its 28GB
(RaspberryPi2)root@localhost:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 451M 0 451M 0% /dev
tmpfs 93M 13M 81M 14% /run
/dev/disk/by-label/system-a 976M 238M 672M 27% /
/dev/mmcblk0p4 28G 1.3G 25G 5% /oem <---
tmpfs 463M 4.0K 463M 1% /etc/fstab
tmpfs 463M 0 463M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 463M 0 463M 0% /sys/fs/cgroup
tmpfs 463M 0 463M 0% /tmp
tmpfs 463M 0 463M 0% /mnt
tmpfs 463M 0 463M 0% /var/lib/sudo
/dev/mmcblk0p1 63M 43M 21M 68% /boot/uboot
cgmfs 100K 0 100K 0% /run/cgmanager/fs
/dev/mmcblk0p3 976M 238M 672M 27% /writable/cache/system
tmpfs 93M 0 93M 0% /run/user/1000
Thank you! I've resized Ubuntu Core 22 on VirtualBox VDI image. This solution works well