Posts Tagged ‘ array

OVH Setup server hybrid second disk array

As OVH doesn’t provide a guide to install the second disk array, which is sold optionally, I will publish my solution.

Please be careful, only try these on test configurations and without any disks containing critical data. Some commands can destroy all of your data.

There seems to be soon a solution within the manager – but for now this isn’t working:

Tested on Ubuntu 14.04

Some commands to detect your actual configuration:

    fdisk -l
    lsblk -o NAME,SIZE,FSTYPE,TYPE,MOUNTPOINT
    df -h -x devtmpfs -x tmpfs

Delete sdb1/sda1 with parted:

    parted /dev/sdb
    (parted) print
    Model: ATA HGST HUS726040AL (scsi)
    Disk /dev/sdb: 4001GB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
 
    Number  Start   End    Size   File system  Name     Flags
     1      1049kB  537MB  536MB               primary  boot
 
    (parted) rm 1
    (parted) quit
 
 
    parted /dev/sda
    (parted) print
    Model: ATA HGST HUS726040AL (scsi)
    Disk /dev/sda: 4001GB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
 
    Number  Start   End    Size   File system  Name     Flags
     1      1049kB  537MB  536MB               primary  boot
 
    (parted) rm 1
    (parted) quit

Add new raid partition (needs to be done for sdb and sda):

    # Create raid 1 in live linux system
    parted -a optimal /dev/sdb
    # Place a flag gpt or mbr
    mklabel gpt
    # Create partition
    mkpart primary ext4 0% 100%
    # Mark partition as software raid partition
    set 1 raid on
    # Verify its alligned
    align-check
    optimal
    # Show results
    print
 
    # Create raid 1 in live linux system
    parted -a optimal /dev/sda
    # Place a flag gpt or mbr
    mklabel gpt
    # Create partition
    mkpart primary ext4 0% 100%
    # Mark partition as software raid partition
    set 1 raid on
    # Verify its alligned
    align-check
    optimal
    # Show results
    print

Create new raid configuration (‘level’ can be used for RAID0/1/5 …):

    mdadm --create --verbose /dev/md4 --level=0 --assume-clean --raid-devices=2 /dev/sdb1 /dev/sda1
    cat /proc/mdstat

In case of renaming:

    # Delete all and rescan
    mdadm -Ss
    mdadm --assemble --verbose /dev/md4 /dev/sdb1 /dev/sda1

Update mdadm configuration:

    # NOT NECCESSAIRE MAYBY USEFUL
    # mdadm --monitor --daemonise /dev/md4
 
    # Capture output
    mdadm --detail --scan
    # Something like: 'ARRAY /dev/md4 UUID=7d45838b:7886c766:5802452c:653f8cca'
    # Needs to be added to the end of file:
    /etc/mdadm/mdadm.conf
 
    # Update initramfs (ignore errors):
    update-initramfs -v -u
 
    # Create file system: 
    mkfs.ext4 -F /dev/md4
 
    # Mount fs:
    mount /dev/md4 /opt/
 
    # Update fstab:
    /etc/fstab
    /dev/md4 	/opt	ext4	defaults 	0	1

Could look something like that:

    lsblk
 
    NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
    sdb           8:16   0   3.7T  0 disk
    `-sdb1        8:17   0   3.7T  0 part
      `-md4       9:4    0   7.3T  0 raid0 /opt
    nvme1n1     259:0    0 419.2G  0 disk
    |-nvme1n1p3 259:3    0   5.4G  0 part  [SWAP]
    |-nvme1n1p1 259:1    0   511M  0 part
    `-nvme1n1p2 259:2    0 413.3G  0 part
      `-md2       9:2    0 413.3G  0 raid1 /
    sda           8:0    0   3.7T  0 disk
    `-sda1        8:1    0   3.7T  0 part
      `-md4       9:4    0   7.3T  0 raid0 /opt
    nvme0n1     259:4    0 419.2G  0 disk
    |-nvme0n1p3 259:7    0   5.4G  0 part  [SWAP]
    |-nvme0n1p1 259:5    0   511M  0 part  /boot/efi
    `-nvme0n1p2 259:6    0 413.3G  0 part
      `-md2       9:2    0 413.3G  0 raid1 /

Now you can reboot the server and verify your configuration.

https://doc.ubuntu-fr.org/raid_logiciel
https://www.psylogical.org/node/198
https://www.digitalocean.com/community/tutorials/how-to-create-raid-arrays-with-mdadm-on-ubuntu-16-04
https://github.com/etalab/etalab-support/tree/master/procedures
https://docs.ovh.com/fr/dedicated/raid-soft/