I have a 1TB ext4 partition mounted at / with all my data and Ubuntu 11.04 (natty) installed.

Now this drive is almost full (I used it as a database server for some processing). RAID0 is ok, I can take a failure (touch wood). But I need a way to grow this partition.

I have a new 1TB drive I want to add, however as my Ubuntu boot and all data is on the one partition I'm not sure how I can go about setting up a RAID0 or LVM array without loosing all my data.

So the question is how can I extend my existing ext4 partition over two physical drives without losing data?


migrated from serverfault.com Apr 6 '12 at 17:09

This question came from our site for system and network administrators.


I'm sure there are many ways to do this, but here, in broad strokes, is how I might tackle it:

  1. Install the new drive into the server.

  2. Change the hard drive boot priority (in BIOS), to put the new drive ahead of the old one.

  3. Install Ubuntu Server onto the new drive, making certain to set it up with LVM.

  4. Copy over all data from the old drive to the new one (using rsync, cp, or similar).

  5. Wipe the old drive, and add it as a new Physical Volume (PV) to the LVM's Volume Group (VG) (pvcreate and vgextend).

  6. Extend Logical Volumes (LV) as desired using the newly added free space (lvextend).

  7. Extend the corresponding filesystems (resize2fs).

  8. Done!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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