Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My hard drive space almost running out, so I installed a new hard drive. My question is, Can I extend an existing patition with newly installed hard drive? e.g. Existing /dev/sda1 /dev/sda2 /dev/sda3

new hard drive /dev/sdb1

Can I extend /dev/sda2 with /dev/sdb1

Thanks in advance!

share|improve this question
add comment

1 Answer

Since your partitions are showing up as /dev/sda*, that means you're using them directly. A physical partition is inherently part of a single disk, so you can't do it directly.

However, it is possible to create a logical partition that spans multiple physical drives, using LVM. LVM can be set up using the Ubuntu installer, but since you already have a working installation you would need to set it up manually. If you have a separate /home partition, this isn't too difficult:

  1. From a live CD, back up your /home partition (e.g. using dd or partimage) to somewhere else.
  2. Format the old /home partition and /dev/sdb1 as LVM physical volumes. If you want more space for the root as well, delete the /home partition and recreate it smaller.
  3. Add the two physical volumes to an LVM volume group.
  4. Create a new LVM volume using all available space.
  5. Restore your image onto the new volume. Expand the partition to fill the entire space using resize2fs.
  6. Adjust your fstab to tell it to automatically mount your logical partition.

Beware: You will lose the logical partition if either disk fails. Keep good backups.

share|improve this answer
    
Thank you very much! –  Jun Dec 2 '12 at 17:47
add comment

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.