Category:

Mount software RAID array in Ubuntu Server 18.04

This post is a continuation of the previous one. Link . It also describes how to fix the array name error.

After logging in, check the RAID array status:

cat /proc/mdstat
adrian@ubuntu-server:~$ cat /proc/mdstat 
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] 
md127 : active (auto-read-only) raid1 sdc1[1] sdb1[0]
      10475520 blocks super 1.2 [2/2] [UU]
      
unused devices: 

If everything is good, and disks are connected that we create the directory where we will mount RAID.

Create a directory to mount in the root of the system:

sudo mkdir Shared

To simply mount see name of a new the high and mount:

sudo fdisk -l
sudo mount /dev/md127p1 /Shared

The drive will be mounted. To view statistics for directory:

stat /Shared

Change access rights.

The owner is the root and the owner group is the user:

sudo chown root:adrian Shared

sudo chmod 775 Shared

Prescribe the rights and create test files to check:

adrian@ubuntu-server:/$ stat Shared/
  File: Shared/
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: 10300h/66304d   Inode: 2           Links: 3
Access: (0775/drwxrwxr-x)  Uid: (    0/    root)   Gid: ( 1000/  adrian)
Access: 2018-08-21 17:33:20.000000000 +0000
Modify: 2018-08-21 17:33:20.000000000 +0000
Change: 2018-08-21 17:56:36.658854307 +0000
 Birth: -
adrian@ubuntu-server:/$ cd Shared/
adrian@ubuntu-server:/Shared$ ls
lost+found
adrian@ubuntu-server:/Shared$ mkdir Folder
adrian@ubuntu-server:/Shared$ touch text.txt
adrian@ubuntu-server:/Shared$ date > date.txt
adrian@ubuntu-server:/Shared$ uptime > uptime.txt

After rebooting, the disk is not mounted. There is empty folder. You need to change the /etc/fstab auto mount settings:

cat /etc/fstab
adrian@ubuntu-server:/$ cat /etc/fstab 
UUID=ae8ea46e-a54d-11e8-91dc-0800270ba4fa / ext4 defaults 0 0
/swap.img       none    swap    sw      0       0

Mount need on ID, because names partitions can change.

To find out the partition ID you need to run:

sudo blkid

The output in the console:

adrian@ubuntu-server:/$ sudo blkid 
[sudo] password for adrian: 
/dev/sda2: UUID="ae8ea46e-a54d-11e8-91dc-0800270ba4fa" TYPE="ext4" PARTUUID="39669673-bf69-49b0-9e75-bb2327a5c67b"
/dev/sdb1: UUID="d988e415-1b7f-30f9-3d24-6a5d70ed725e" UUID_SUB="886204d6-9bba-0a79-041a-40f0c4c281b1" LABEL="ubuntu-server:0" TYPE="linux_raid_member" PARTUUID="12042d1e-01"
/dev/sdc1: UUID="d988e415-1b7f-30f9-3d24-6a5d70ed725e" UUID_SUB="8ad945d1-359c-25f7-c39b-ee99b97d6646" LABEL="ubuntu-server:0" TYPE="linux_raid_member" PARTUUID="7ff9b8cd-01"
/dev/md127p1: UUID="63f8a296-1fc4-4eb3-8636-05673dfa072f" TYPE="ext4" PARTUUID="38ff5a9e-01"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/sda1: PARTUUID="593dee0f-0482-40df-9061-9db88b594ed8"
/dev/md127: PTUUID="38ff5a9e" PTTYPE="dos"
adrian@ubuntu-server:/$

We need the partition /dev/md127p1:

Edited fstab (enter the ID without quotes):

  GNU nano 2.9.3                                                                         /etc/fstab                                                                                   
UUID=ae8ea46e-a54d-11e8-91dc-0800270ba4fa / ext4 defaults 0 0
/swap.img       none    swap    sw      0       0
# New Raid1
UUID=63f8a296-1fc4-4eb3-8636-05673dfa072f       /Shared   ext4    defaults        0       0

After reboot the partition will be automatically mounted to the Shared directory.


Posted: 2018-09-02

Comments