How to extend vyos disk?

How to change the mount point size?
df command will show 2G for the mount point

/dev/vda1       2.0G  1.2G  681M  64% /usr/lib/live/mount/persistence

But fdisk -l will show disk size is 21GB .
The question is how to extend /usr/lib/live/mount/persistence size to all the disk space?

root@svr03-xxx-xxx-xxx-xxx:/home/myadmin# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            2.0G     0  2.0G   0% /dev
tmpfs           395M   11M  384M   3% /run
/dev/vda1       2.0G  1.2G  681M  64% /usr/lib/live/mount/persistence
/dev/loop0      277M  277M     0 100% /usr/lib/live/mount/rootfs/1.3.2.squashfs
tmpfs           2.0G     0  2.0G   0% /usr/lib/live/mount/overlay
overlay         2.0G  1.2G  681M  64% /
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
tmpfs           2.0G  200K  2.0G   1% /var/tmp
tmpfs           2.0G  4.0K  2.0G   1% /tmp
none            2.0G  848K  2.0G   1% /opt/vyatta/config
unionfs-fuse    2.0G  848K  2.0G   1% /opt/vyatta/config/tmp/new_config_2934
tmpfs           395M     0  395M   0% /run/user/1006
root@svr03-xxx-xxx-xxx-xxx:/home/myadmin# fdisk -l
Disk /dev/vda: 20 GiB, 21474836480 bytes, 41943040 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: 0x46066065

Device     Boot Start      End  Sectors Size Id Type
/dev/vda1  *     2048 41943039 41940992  20G 83 Linux


Disk /dev/loop0: 276.2 MiB, 289587200 bytes, 565600 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

have you read this?

I knew it! But it didn’t works. You can see my post that show the fdisk or parted is right. But the mount point still mount 2GB. not take all of 20GB .

It’s not enough to just modify the volume size and the partition table, you also need to extend the filesystem with resize2fs. See the link in the post @tomcat667 provided you.

Already did it. No can do to extend the disk size. BTW, the disk image is that I install kvm vm with vyos 1.3.3.iso. then I backup it with dd command, after that I use dd to restore to another kvm host. at last I can’t extend the disk capcity.

I’ve tried this on a VM and it works fine for me. I start with a fresh 1.3.3 install on a 3G storage. I then extended the storage to 6G. Once I’ve done that, fdisk notices the discrepancy between the physical device bounds and the partition table:

root@vyos:~# fdisk /dev/sda

Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

GPT PMBR size mismatch (6291455 != 12435455) will be corrected by write.
The backup GPT table is not on the end of the device. This problem will be corrected by write.

Command (m for help): p

Disk /dev/sda: 6 GiB, 6366953472 bytes, 12435456 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: E4FA32A3-8E32-41AE-8151-8D4D1A7BDC6D

Device      Start     End Sectors  Size Type
/dev/sda1      34    2047    2014 1007K BIOS boot
/dev/sda2    2048  526335  524288  256M EFI System
/dev/sda3  526336 6291422 5765087  2.8G Linux filesystem

I deleted the root partition and created a new one that extends to the end of the disk:

Disk /dev/sda: 6 GiB, 6366953472 bytes, 12435456 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: E4FA32A3-8E32-41AE-8151-8D4D1A7BDC6D

Device      Start      End  Sectors  Size Type
/dev/sda1      34     2047     2014 1007K BIOS boot
/dev/sda2    2048   526335   524288  256M EFI System
/dev/sda3  526336 12435422 11909087  5.7G Linux filesystem

df -h still shows the pre-extended size:

/dev/sda3       2.7G  412M  2.1G  17% /usr/lib/live/mount/persistence

Now I used resize2fs /dev/sda3 to extend the ext4 root partition. and now df -h shows:

/dev/sda3       5.6G  412M  4.9G   8% /usr/lib/live/mount/persistence
1 Like

Or simply: force root-partition-auto-resize

 force root-partition-auto-resize
There is no available space for root partition extension