Hi all,
Similar installation instructions can be found in vl1969 's post : [HOW-TO] Convert OMV install to system RAID-1 install
But since it's old, I decided to write a new one here, for anyone to read and suggest changes.
First of all I should explain the main purpose of this try. It is to have an OMV installation with :
- using the hole space of the installation media for storage
- have system redundancy
***
Sure there is a more sophisticated system backup method documented in this forum, via the OMV Backup plugin e.g.
But since in my work place there is a "difficulty" in buying stuff like usb flash drives ( ) and on the other hand there are plenty of unused 160GB hard drives, I chose to give it a try with RAID.
***
** The installation process I followed was based in a post by Josip Lazić, found here : Installing OpenMediaVault on RAID-1 array
1. OMV installation
At first I installed the latest OMV on a 160GB hard disk, following the official OMV documentation.
This disk is going to act like the installation prototype (lets say so !! ).
Shutdown the machine and connect two other 160GB hard disk drives. These are going to be the installation media of my new system.
The following procedure can be applied via ssh connection.
2. Listing the connected disks
Listing `openmediavault` connected disks we see:
root@omv:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 149.1G 0 disk
├─sda1 8:1 0 148.1G 0 part /
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 976M 0 part [SWAP]
sdb 8:16 0 149.1G 0 disk
sdc 8:32 0 149.1G 0 disk
where `sda` is the initial disk ("prototype") and `sdb` and `sdc` are the disks going to form the RAID array.
** I intent to create 4 partitions in both two OMV system disks, `sdb` and `sdc`:
- 1st: grub / 12MB ??
- 2nd: swap / 32GB
- 3rd: system / 28GB
- 4th: data / 100GB (the rest of the disk)
3. Create partitions on the first drive `/dev/sdb`
root@omv:~# parted -a optimal /dev/sdb mklabel gpt
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
Information: You may need to update /etc/fstab.
root@omv:~# parted -a optimal /dev/sdb mkpart grub ext2 2048s 12M
Information: You may need to update /etc/fstab.
root@omv:~# parted -a optimal /dev/sdb mkpart swap linux-swap 12M 32GB
Information: You may need to update /etc/fstab.
root@omv:~# parted -a optimal /dev/sdb mkpart root ext4 32GB 60GB
Information: You may need to update /etc/fstab.
root@omv:~# parted -a optimal /dev/sdb mkpart data ext4 60GB 100%
Information: You may need to update /etc/fstab.
root@omv:~# parted -a optimal /dev/sdb set 1 bios_grub on
Information: You may need to update /etc/fstab.
root@omv:~# parted -a optimal /dev/sdb set 2 swap on
Information: You may need to update /etc/fstab.
root@omv:~# parted -a optimal /dev/sdb set 3 boot on
Information: You may need to update /etc/fstab.
Display More
4. Clone partition table to the second drive `/dev/sdc`
To replicate partition table to `/dev/sdc` I run:
root@omv:~# sgdisk -R=/dev/sdc /dev/sdb
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
The operation has completed successfully.
5. Randomize the GUID on the disk `/dev/sdc` and all it's partitions (because the above "cloning" command clones GUID's also!)
root@omv:~# sgdisk -G /dev/sdc
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
The operation has completed successfully.
** checking the partitions, now both `sdb` and `sdc` seems like :
root@omv:~# parted /dev/sdb u s p
Model: ATA ST3160815AS (scsi)
Disk /dev/sda: 312581808s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 2048s 22527s 20480s grub bios_grub
2 22528s 62500863s 62478336s swap swap
3 62500864s 117186559s 54685696s root boot, esp
4 117186560s 312580095s 195393536s data
root@omv:~# parted /dev/sdc u s p
Model: ATA ST3160813AS (scsi)
Disk /dev/sdc: 312581808s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 2048s 22527s 20480s grub bios_grub
2 22528s 62500863s 62478336s swap swap
3 62500864s 117186559s 54685696s root boot, esp
4 117186560s 312580095s 195393536s data
Display More
6. Create mdadm RAID array for swap partitions
root@omv:~# mdadm --create /dev/md0 --level=1 --raid-devices=2 --metadata=0.90 /dev/sdb2 /dev/sdc2
mdadm: array /dev/md0 started.
7. Create mdadm RAID array for root partitions
root@omv:~# mdadm --create /dev/md1 --level=1 --raid-devices=2 --metadata=0.90 /dev/sdb3 /dev/sdc3
mdadm: array /dev/md1 started.
8. Create mdadm RAID array for data partitions
root@omv:~# mdadm --create /dev/md2 --level=1 --raid-devices=2 --metadata=0.90 /dev/sdb4 /dev/sdc4
mdadm: array /dev/md2 started.
9. Create swap filesystem on `/dev/md0`
root@omv:~# mkswap /dev/md0
Setting up swapspace version 1, size = 29.8 GiB (31988838400 bytes)
no label, UUID=d2691e45-c941-4c2a-b0fe-c5de59128ed6
.... to be continued