0

I have an Ubuntu 12.04 server with two 3TB disks and Software-RAID 1. Currently they are partitioned as follows:

# discus
Mount           Total         Used         Avail      Prcnt      Graph
/                1.00 TB      8.55 GB      0.99 TB     0.8%   [----------]
+onnections         0 KB         0 KB         0 KB     0.0%   [----------]
+rnel/debug         0 KB         0 KB         0 KB     0.0%   [----------]
+l/security         0 KB         0 KB         0 KB     0.0%   [----------]
/run             3.12 GB       304 KB      3.12 GB     0.0%   [----------]
/run/lock         5.0 MB         0 KB       5.0 MB     0.0%   [----------]
/run/shm         7.79 GB         0 KB      7.79 GB     0.0%   [----------]
/home            1.70 TB     13.06 GB      1.68 TB     0.8%   [----------]
/boot           495.8 MB      38.0 MB     457.9 MB     7.7%   [*---------]


# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/md2        1.0T  8.6G  964G   1% /
udev            7.8G  4.0K  7.8G   1% /dev
tmpfs           3.2G  304K  3.2G   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            7.8G     0  7.8G   0% /run/shm
/dev/md3        1.7T   14G  1.6T   1% /home
/dev/md1        496M   38M  433M   9% /boot


# cat /proc/partitions 
major minor  #blocks  name

   8        0 2930266584 sda
   8        1   33554432 sda1
   8        2     524288 sda2
   8        3 1073741824 sda3
   8        4 1822443975 sda4
   8        5       1024 sda5
   8       16 2930266584 sdb
   8       17   33554432 sdb1
   8       18     524288 sdb2
   8       19 1073741824 sdb3
   8       20 1822443975 sdb4
   8       21       1024 sdb5
   9        0   33553336 md0
   9        1     524276 md1
   9        2 1073740664 md2
   9        3 1822442815 md3

I would like to reduce / to 100Gb and grow /home to 2.6Tb. What's the best way to do that? Server has no important data so I don't care about possible data loss.

src091
  • 267
  • 3
  • 4
  • 8
  • 1
    Consider setting up LVM atop an md device. You will have to repartition everything, of course. – Alex Jul 11 '12 at 16:49

1 Answers1

1

The trick is using your second drive in RAID as spare one:

  1. Break the mirror(s) you have (except /boot one, if you have it);
  2. Create one big single partition for RAID on the disengaged drive (in addition to /boot's);
  3. Create RAID-1 using missing device (see man mdadm for that) and the partition;
  4. Make new mirror to be LVM-2 disk (pvcreate);
  5. Create volume group (vgcreate) and needed logical volumes (lvcreate), format them, mount temporary;
  6. Copy your stuff;
  7. Correct new /etc/fstab, make sure initrd would handle root filesystem on LVM-2 ok;
  8. Boot in;
  9. Stop old (intentionally broken) RAID;
  10. Partition its disk as replica of disengaged drive;
  11. Add it to new RAID so it would be based on missing drive no more.
poige
  • 9,171
  • 2
  • 24
  • 50