Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a linux box with CentOS 6.2 and a RAID1 (2x 2Tb) configuration:

/dev/md1 -> / (10G)
/dev/md2 -> /home (1.9T)

I want to split the md2 in two different partitions, so I can get the following configuration:

/dev/md1 -> / (10G)
/dev/md2 -> /home (1T)
/dev/md3 -> /example (900G)

How can I achieve this? I already know that I can resize the partition, but that doesn't alter the real partition table (only the md device), so how can I do this?

share|improve this question

If you are not using LVM, you need to:

  • remove the md device (using mdadm),
  • remove the partition (using fdisk),
  • recreate the needed partitions (using fdisk),
  • and then recreate the md device (using mdadm).
share|improve this answer

you are best of using logical volumes.

You can then create, expand and pretty much do as much as you want.

there is a nice guide here

share|improve this answer

The correct (initial) way would have been to overlay LVM on top of the RAID array, and then re-allocate volumes as needed. But you're not at a point where this is probably feasible.

You may still have a way out. Ext3/Ext2 are re-sizable, although it is slightly risky when you are contracting filesystems. I don't recommend this unless you have no other options or you're willing to risk your data:

  1. mount the array on a different machine. This is necessary because your boot/root is on the array, complicating the process. You could do this with a read-only mount, etc. but let's keep it simple.
  2. you shrink the Ext2/3 filesystem to the new size. This creates "space". Note that the shrunk size is limited to the amount of data stored on disk...if you have 3Gbyte of data, you can't shrink it to 2.5Gbyte and expect it to work.
  3. you then shrink the hard drive partition to match. This is the tricky part. Shrink too much, and you end up with a nasty overlap that will cause you to loose data. It doesn't hurt if the partition is slightly larger than the filesystem size; you can always expand the existing partition into the extra space.
  4. Write the partition table out to the MD device.

You have two paths now, one with LVM, one without.

With old-style partitions:

  1. create one or more new disk partitions (as many as needed)
  2. format each partition as a filesystem.
  3. move existing filesystem data into the newly created partitions
  4. edit /etc/fstab to mount the new partitions at boot time

With LVM:

  1. mark all of the existing "new" space as an LVM partition. Write the partition changes to disk.
  2. create a new Volume Group from the partion.
  3. Allocate logical volumes from the volume group
  4. format each logical volume as a filesystem.
  5. move existing filesystems into the newly created logical volumes
  6. edit your /etc/fstab to mount the new LVM volumes at boot time
share|improve this answer

Your Answer


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.