Skip to main content
Title no fits better the real topic of that question and prevent other question to marked as duplicate.
Link

Resize MDADM How to resize /Software RAID underlying partition and filesystem shifting partitions?

added 243 characters in body
Source Link

I am running out of space on my root partition and would like to steal some from a different partition. The drives are 2x120GB with mdadm software RAID. I am using CentOS 6.5 64-bit. I used the centos installer guided RAID setup. It seems like most of the HowTos are gearing me towards not having the underlying partitions. So others would have just /dev/md0. They would perform a resize2fs /dev/md0 25G (reducing from 50G for example) and then use mdadm to resize it, etc.

I am running out of space on my root partition and would like to steal some from a different partition. The drives are 2x120GB with mdadm software RAID. I am using CentOS 6.5 64-bit. I used the centos installer guided RAID setup.

I am running out of space on my root partition and would like to steal some from a different partition. The drives are 2x120GB with mdadm software RAID. I am using CentOS 6.5 64-bit. I used the centos installer guided RAID setup. It seems like most of the HowTos are gearing me towards not having the underlying partitions. So others would have just /dev/md0. They would perform a resize2fs /dev/md0 25G (reducing from 50G for example) and then use mdadm to resize it, etc.

Source Link

Resize MDADM/Software RAID underlying partition and filesystem

I am running out of space on my root partition and would like to steal some from a different partition. The drives are 2x120GB with mdadm software RAID. I am using CentOS 6.5 64-bit. I used the centos installer guided RAID setup.

The layout is:

Filesystem            Size  Used Avail Use% Mounted on
/dev/md0p5            9.7G  7.1G  2.1G  78% /
tmpfs                  16G     0   16G   0% /dev/shm
/dev/md0p1            194M   99M   86M  54% /boot
/dev/md0p2             68G  7.2G   57G  12% /var/www

cat /proc/mdstat:

Personalities : [raid1] 
md0 : active raid1 sdb[1] sda[0]
      117220736 blocks [2/2] [UU]
      
unused devices: 

Here is the fdisk:

fdisk -l

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00035afc

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26        8950    71680000   83  Linux
/dev/sda3            8950       11039    16777216   82  Linux swap / Solaris
/dev/sda4           11039       14594    28557312    5  Extended
/dev/sda5           11039       12314    10240000   83  Linux

Disk /dev/sdb: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00035afc

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sdb2              26        8950    71680000   83  Linux
/dev/sdb3            8950       11039    16777216   82  Linux swap / Solaris
/dev/sdb4           11039       14594    28557312    5  Extended
/dev/sdb5           11039       12314    10240000   83  Linux

Disk /dev/md0: 120.0 GB, 120034033664 bytes
2 heads, 4 sectors/track, 29305184 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00035afc

    Device Boot      Start         End      Blocks   Id  System
/dev/md0p1   *         257       51456      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/md0p2           51457    17971456    71680000   83  Linux
Partition 2 does not end on cylinder boundary.
/dev/md0p3        17971457    22165760    16777216   82  Linux swap / Solaris
Partition 3 does not end on cylinder boundary.
/dev/md0p4        22165761    29305088    28557312    5  Extended
Partition 4 does not end on cylinder boundary.
/dev/md0p5        22166273    24726272    10240000   83  Linux

So what can I do to grow the root partition and shrink the /var/www partition?