We have a server that was set up with an ubuntu software raid setup in raid 1 with 2 6TB hard drives so that we have 6TB of storage available and backed up so we are safe if one of the hard drives fails. I want to add 2 4TB hard drives to increase the available space to 10TB total as our server is getting full. How do I go about doing this? I understand adding them to the current raid array would actually result in only 4TB of space being available in total as it would try to mirror the data on the 4 drives.

Do I need to add a new raid array in this case?

The result of running mdadm -D /dev/md0 on the server as it is currently stands is as follows:

        Version : 1.2
  Creation Time : Wed Apr 20 15:54:49 2016
     Raid Level : raid1
     Array Size : 5850527552 (5579.50 GiB 5990.94 GB)
  Used Dev Size : 5850527552 (5579.50 GiB 5990.94 GB)
   Raid Devices : 2
  Total Devices : 2
    Persistence : Superblock is persistent

    Update Time : Sun Apr  9 01:38:21 2017
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

           Name : lazarus:0  (local to host lazarus)
           UUID : 1853e775:0771cfa7:d64ea77b:9f222c27
         Events : 2274

    Number   Major   Minor   RaidDevice State
       0       8        3        0      active sync   /dev/sda3
       1       8       19        1      active sync   /dev/sdb3

The output of lsblk is:

sda       8:0    0   5.5T  0 disk
├─sda1    8:1    0    94M  0 part  /boot
├─sda2    8:2    0   9.3G  0 part
│ └─md1   9:1    0  18.6G  0 raid0 [SWAP]
└─sda3    8:3    0   5.5T  0 part
  └─md0   9:0    0   5.5T  0 raid1 /
sdb       8:16   0   5.5T  0 disk
├─sdb1    8:17   0    94M  0 part
├─sdb2    8:18   0   9.3G  0 part
│ └─md1   9:1    0  18.6G  0 raid0 [SWAP]
└─sdb3    8:19   0   5.5T  0 part
  └─md0   9:0    0   5.5T  0 raid1 /
sr0      11:0    1  1024M  0 rom

The hard-drives are not yet in the chassis, in case people were thinking that was the case.

  • Please show us the output of command lsblk. – Mikhail Khirgiy Apr 9 '17 at 5:21

I would have done for myself so:

  1. Make backup all important data.
  2. Add LVM support to your system by installing lvm2 package.
  3. Insert both new disks into the server and create on them RAID with level 0. You will temporary get 8Tb free space on it. By example md5.
  4. Find directory, where most data was placed. By example /var/lib/ftproot.
  5. Boot from SystemRescueCD or from your system installation CD/DVD in rescue mode.
  6. Create new dir /mnt/temp and mount new raid md5 there.
  7. Move data from /var/lib/ftproot to /mnt/temp.
  8. Shink root filesystem on md0.
  9. Shrink the raid device md0.
  10. Shrink partitions /dev/sda3 and /dev/sdb3
  11. Create new partitions on free disk spaces /dev/sda4 and /dev/sdb4.
  12. Create new RAID md3 device with level 1 (mirror).
  13. Create new LVM physical volume by command: pvcreate /dev/md3.
  14. Create new LVM volume group by command: vgcreate VG0 /dev/md3.
  15. Create new LVM volume with name ftproot and size 5Tb by command: lvcreate -L 5000G -n ftproot VG0.
  16. Create xfs file-system on new LVM volume: mkfs -t xfs /dev/VG0/ftproot
  17. Create directory /mnt/ftproot and mount new filesystem there: mount /dev/VG0/ftproot /mnt/ftproot.
  18. Move all data from /mnt/temp to /mnt/ftproot.
  19. Add to the fstab new mount point: echo "/dev/VG0/ftproot /var/lib/ftproot xfs defaults 0 0" >> /etc/fstab
  20. Unmount all in /mnt directory and reboot sever to boot from disk.
  21. Delete RAID device md5.
  22. Create new RAID device md5 with level 1 (mirror).
  23. Create new LVM physical volume on it by command: pvcreate /dev/md5.
  24. Add new physical volume to existing LVM volume group: vgextend VG0 /dev/md5
  25. Increase size of ftproot LVM volume to 8000Gb online (by example): lvresize -L 8000G /dev/VG0/ftproot.
  26. Increase size of xfs file-system on ftproot to maximum online: xfs_growfs /dev/VG0/ftproot.

Thats all... Be carefully with commands. This is only example how to do it. You can read also Resize RAID partition with GPT partition layout, without LVM. XFS file-system is good for large files than ext4, but it's size can't be reduced.

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.