We have this scenario : I to increase the disk space of one of our VM,
Disk details :
root@Test-01:~# blkid
/dev/vda2: UUID="0eae0eb4-92ed-45ec-aa99-6d606f17e70a" TYPE="swap" PARTUUID="06cf22a2-02"
/dev/vda1: UUID="b5e223df-9f41-4e4c-aa8d-e4529fa28424" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="06cf22a2-01"
root@Test-01:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 254:0 0 150G 0 disk
├─vda1 254:1 0 46G 0 part /
└─vda2 254:2 0 104G 0 part [SWAP]
As its a Not LVM I have tried the below , but its wont work
parted /dev/vda resizepart 1 100%
resize2fs /dev/vda1
root@Test-01:~# parted /dev/vda print free
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 161GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1024B 1049kB 1048kB Free Space
1 1049kB 49.4GB 49.4GB primary ext4
2 49.4GB 161GB 112GB primary linux-swap(v1)
we need the swap to go in the last in memory block, swap is in between
we have 112GB primary Linux-swap(v1)
now we want to increase first partition end block to 156 instead of 49.4 gb
now we want to decrease 2nd partition start block to 156 instead of 49.4 gb
we want to increase the root volum with safe option without loosing any data ,
Is Performing the resize operation with parted alone is risky and could lead to data loss? So below doesn't look like safe for me.
sudo parted /dev/vda resizepart 1 100%
sudo parted /dev/vda move 2 100%
This is a virtual machine not a physical machine we are not a not able to use usb or cd drive there , its a Linux Debian machine .
what is the best way to perform this without losing the root volume data , any help would be apricated .