Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have several Ubuntu Linux virtual machines running on VMware ESXi hosts that have all been allocated disks much larger than their required capacity. As space is now becoming an issue on our SAN, I'd like to investigate downsizing the allocated disk space on these machines.

All systems will be completely backed up imaged before I begin making changes, and I will always retain a pristine backup in case the partition resizing does not work.

Is there an easier way than the following procedure, or is their a better solution entirely?

  1. Shutdown and assign a second disk to the virtual machine
  2. Boot using the SystemRescueCD
  3. Use GParted to resize the original (source) partition, making it smaller
  4. Clone the new, smaller partition to the second disk
  5. Shutdown and remove initial disk from the virtual machine
  6. Reboot and force fsck to check the filesystem
share|improve this question

1 Answer 1

up vote 2 down vote accepted

I wouldn't clone. What I would do is mount the second drive in the system, partition and format it appropriately, use tar or cpio to transfer all the files across, remove the original drive, then install grub on the new drive. This removes the need to shrink anything, and as a side effect it cleans up any fragmentation that may have happened.

Or if you're using LVM, add the PV on the second drive to the VG, shrink the FS and LV, migrate the LV over to the new drive, then install grub. This will require shrinking, but after the shrink operation the LV migration can be done live.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.