-1

I created a linux VM and am trying to increase the disk size of the root device /dev/xvda but not sure how to do this the right/proper way

Also do i have to shutdown the VM to be able to do this?

Device     Boot Start      End  Sectors Size Id Type
/dev/xvda1 *     2048 33552383 33550336  16G 83 Linux

Thanks

uberrebu
  • 493
  • 5
  • 15
  • 32
  • https://support.citrix.com/article/CTX125405 – user9517 Aug 14 '16 at 15:31
  • i came across that link before posting question, and am not sure why i will delete partition and expect to keep my data, i am not trying to delete data, just want to extend size to new size so OS can see it. – uberrebu Aug 14 '16 at 19:03
  • Deleting a partition and recreating a new (larger) one over the top should not lose any data. You should test this in a lab though. – user9517 Aug 14 '16 at 19:37
  • i only have one partition and that is the `ROOT` partition `/` so how in hell will i delete? – uberrebu Aug 14 '16 at 21:35
  • You are only deleting and recreating the partition record. You really do need to lab this just so you can understand what is going on. – user9517 Aug 14 '16 at 21:49
  • works..i think key part was login as single user @Iain can put as answer so i accept? – uberrebu Aug 14 '16 at 22:20
  • No, I can't be bothered, write it up yourself. – user9517 Aug 14 '16 at 22:22

3 Answers3

0

Have you already resized the underlying block device (xvda)? If so then resizing the filesystem depends on its type.

If its ext4 then you can do it online without powering off your VPS. The command is

resize2fs /dev/xvda 

If its xfs then you can also do it online with the following command

xfs_growfs -d /

Are you sure that your filesystem lives in a partitonless device?

* EDIT *

I just noticed that your filesystem is on /dev/xvda1 partition.

That means that you have to extend the partition size before growing the filesystem. This cannot be done online you have to start your VPS in recovery mode and then use parted to grow your partition so it can fit the new underlying block device.

Vikelidis Kostas
  • 927
  • 1
  • 6
  • 15
  • how do i use parted to grow partition? (if i knew i wont be posting question) and i am not using desktop OS, i am using server OS so booting live CD is doing too much on a 512MB server – uberrebu Aug 14 '16 at 19:00
  • Follow this guide: [link](https://www.gnu.org/software/parted/manual/html_node/parted_31.html) Ignore step 2 if you don't have a swap partition. – Vikelidis Kostas Aug 15 '16 at 06:43
0

An alternative option,

  1. You could create a new larger block device and attach it to your VM
  2. Create a new partition scheme and format the partitions on it
  3. Copy everything to it
  4. Write grub to it (if that's difficult, do it in the next step with a rescue ISO)
  5. Shutdown, reconfigure the VM to use the new block device and boot
Ryan Babchishin
  • 6,160
  • 2
  • 16
  • 36
0

https://support.citrix.com/article/CTX125405

  1. shutdown VM

  2. increase disk size

  3. boot into single user mode

  4. follow guide https://support.citrix.com/article/CTX125405

  5. start machine and run resize2fs (again https://support.citrix.com/article/CTX125405)

Thats it folks

uberrebu
  • 493
  • 5
  • 15
  • 32