Disk management with LVM

You can create a partition with LVM (Logical Volume Manager). You can take a backup using a snapshot.

Create partition

// Edit using partition.
parted /dev/sda

// Init for LVM phisical volume(PV).
pvcreate /dev/sda3

// Create volume group(VG) and append PV.
vgcreate vg1 /dev/sda3

// Check VG.
vgdisplay

// Create logical volume(LV).
lvcreate -L 50G -n lv1 vg1

// Check logical volumes.
lvdisplay

Using partition.

// format.
mkfs.xfs /dev/vg1/lv1

// Mount (use blkid command)
vi /etc/fstab
UUID="56d4a451-42ff-43fa-a026-4da" /mnt/ddrv xfs defaults 0 0

mount -a

Snapshot (Live backup)

Back up the image without stopping the KVM virtual environment.

// Create SnapShot
lvcreate -s -n Snap1 -l 100%FREE /dev/vg1/lv1

// Mount
mount -o nouuid -r /dev/vg1/Snap1 /mnt/Snap1

// copy job
cp -f /mnt/Snap1/VyOS.img /mnt/backup/

// Unmount
cd
umount /mnt/Snap1

// Remove.
lvremove -f /dev/vg1/Snap1