Auto Mount Raid1 using systemd service in CentOS 7 / Ubuntu 16

Auto Mount Raid1 using systemd service in CentOS 7 / Ubuntu 16


raid 1 configuration, RAID1 Configuration On CentOS 7 ubuntu, mdadm, raid 1, raid configuration, raid configuration in linux, mdadm commands in linux, mdadm command, mdadm linux,  disk mirroring


Step 1:

Create raid1.mount file on /lib/systemd/system

vi /lib/systemd/system/raid1.mount
[Unit]
Description=Mount Raid1 File System
Requires=raid1.service
[Mount]
What=/dev/md0
Where=/raid1
Type=ext4
Options=defaults
[Install]
WantedBy=multi-user.target


Step 2:

Create raid1.service file on /lib/systemd/system
vi /lib/systemd/system/raid1.service
[Unit]
Description=Assemble Raid1 File System
[Service]
ExecStart=/usr/local/bin/raid1
[Install]
WantedBy=multi-user.target


Step 3:

Crate command to assemble raid device
vi /usr/local/bin/raid1
#!/bin/bash
# Command to Start Raid1 assemble on Boot #
/usr/sbin/mdadm --assemble /dev/md0 /dev/sdb1 /dev/sdc1

   
Step 4:

Start Raid1.mount and Raid1.service

systemctl start raid1.mount
systemctl start raid1.service
Enable at boot
systemctl enable raid1.mount
systemctl enable raid1.service



Previous
Next Post »