Linux mint and raid

How to Configure and Test RAID 0 on Linux Mint 20

Redundant Array of Independent Disks (RAID) is a data storage virtualization technology that connects multiple physical disk drive components into a single logical unit for the purposes of data redundancy, performance improvement. The concept of RAID 0 is the data that is split and stores in the drives. If the data from one drive is corrupted then the entire data will be lost. This tutorial will cover configure and test RAID 0 on Linux Mint 20.

Installation Procedure:

First check the version of the Linux mint 20.

[email protected]:~# lsb_release -a No LSB modules are available. Distributor ID: Linuxmint Description: Linux Mint 20 Release: 20 Codename: ulyana 

Now list the disk by executing the following command

[email protected]:~# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 20G 0 disk ├─sda1 8:1 0 3.7G 0 part /swap ├─sda2 8:2 0 1K 0 part ├─sda5 8:5 0 976M 0 part /boot └─sda6 8:6 0 15.3G 0 part / sdb 8:16 0 20G 0 disk sdc 8:32 0 20G 0 disk sr0 11:0 1 1.9G 0 rom /media/user/Linux Mint 20 Cinnamon 64-bit 

Now create a partitions by using the following command

[email protected]:~# fdisk /dev/sdb Welcome to fdisk (util-linux 2.34). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table. Created a new DOS disklabel with disk identifier 0xc74df8b6. Press n to create partition Command (m for help): n Enter the partition type Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): p Partition number (1-4, default 1): First sector (2048-41943039, default 2048): Enter the partition size Last sector, +/-sectors or +/-size (2048-41943039, default 41943039): +1G Created a new partition 1 of type 'Linux' and of size 1 GiB. Enter t to change the type of partiton Command (m for help): t Selected partition 1 Hex code (type L to list all codes): fd Changed type of partition 'Linux' to 'Linux raid autodetect'. Press w to write the partition Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. 

Now follow the steps to create the another partition

[email protected]:~# fdisk /dev/sdc Welcome to fdisk (util-linux 2.34). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table. Created a new DOS disklabel with disk identifier 0x328e0fde. Command (m for help): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): p Partition number (1-4, default 1): First sector (2048-41943039, default 2048): Last sector, +/-sectors or +/-size (2048-41943039, default 41943039): +1G Created a new partition 1 of type 'Linux' and of size 1 GiB. Command (m for help): t Selected partition 1 Hex code (type L to list all codes): fd Changed type of partition 'Linux' to 'Linux raid autodetect'. Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. 

Create RAID by using the following command

ro[email protected]:~# mdadm -C /dev/md0 -l 0 -n 2 /dev/sdb1 /dev/sdc1 mdadm: Defaulting to version 1.2 metadata mdadm: array /dev/md0 started. 

Now format the raid in ext4 format by executing the below command

[email protected]:~# mkfs.ext4 /dev/md0 mke2fs 1.45.5 (07-Jan-2020) Creating filesystem with 523264 4k blocks and 130816 inodes Filesystem UUID: 9e759bbe-e7c7-497e-8432-e31da81a6632 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912 Allocating group tables: done Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done 

Now list the raid details by enter the command

[email protected]:~# mdadm --detail /dev/md0 /dev/md0: Version : 1.2 Creation Time : Tue Jan 19 15:49:23 2021 Raid Level : raid0 Array Size : 2093056 (2044.00 MiB 2143.29 MB) Raid Devices : 2 Total Devices : 2 Persistence : Superblock is persistent Update Time : Tue Jan 19 15:49:23 2021 State : clean Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 Layout : -unknown- Chunk Size : 512K Consistency Policy : none Name : linuxhelp:0 (local to host linuxhelp) UUID : 13958fbe:5f733618:4e8fc7e7:88dcbd00 Events : 0 Number Major Minor RaidDevice State 0 8 17 0 active sync /dev/sdb1 1 8 33 1 active sync /dev/sdc1 

Now create the directory for mount the raid to the drive

Читайте также:  Переменная окружения linux время

Now mount the raid to the directory

Edit the fstab file for permanent mounting for that I am copying from the mtab

[email protected]:~# cat /etc/mtab sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0 proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0 . . . tmpfs /run/user/1000 tmpfs rw,nosuid,nodev,relatime,size=400220k,mode=700,uid=1000,gid=1000 0 0 gvfsd-fuse /run/user/1000/gvfs fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0 /dev/sr0 /media/user/Linux\040Mint\04020\040Cinnamon\04064-bit iso9660 ro,nosuid,nodev,relatime,nojoliet,check=s,map=n,blocksize=2048,uid=1000,gid=1000,dmode=500,fmode=400 0 0 /dev/md0 /root/raid ext4 rw,relatime,stripe=256 0 0 [email protected]:~# vim /etc/fstab 

Add the line for permanent mounting

/dev/md0 /root/raid ext4 rw,relatime,stripe=256 0 0 

Now list the drive by executing the following command

[email protected]:~# df -h Filesystem Size Used Avail Use% Mounted on udev 1.9G 0 1.9G 0% /dev tmpfs 391M 1.6M 390M 1% /run /dev/sda6 16G 6.8G 7.5G 48% / tmpfs 2.0G 0 2.0G 0% /dev/shm tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup /dev/sda5 945M 108M 773M 13% /boot /dev/sda1 3.7G 15M 3.4G 1% /swap tmpfs 391M 16K 391M 1% /run/user/1000 /dev/sr0 1.9G 1.9G 0 100% /media/user/Linux Mint 20 Cinnamon 64-bit /dev/md0 2.0G 6.0M 1.9G 1% /root/raid 

Now I am enter into the raid directory and add some files on the directory

[email protected]:~# cd raid/ [email protected]:~/raid# touch a b c [email protected]:~/raid# mkdir aa bb cc [email protected]:~/raid# ls -la total 36 drwxr-xr-x 6 root root 4096 Jan 19 15:53 . drwx------ 5 root root 4096 Jan 19 15:51 .. -rw-r--r-- 1 root root 0 Jan 19 15:53 a drwxr-xr-x 2 root root 4096 Jan 19 15:53 aa -rw-r--r-- 1 root root 0 Jan 19 15:53 b drwxr-xr-x 2 root root 4096 Jan 19 15:53 bb -rw-r--r-- 1 root root 0 Jan 19 15:53 c drwxr-xr-x 2 root root 4096 Jan 19 15:53 cc drwx------ 2 root root 16384 Jan 19 15:49 lost+found 

Unmount the directory and test the RAID 0.

Читайте также:  Linux console package manager

Now I am fail the sdb1 partition

[email protected]:~# mdadm /dev/md0 -f /dev/sdb1 mdadm: set device faulty failed for /dev/sdb1: Device or resource busy 

Now command the mounting from the fstab file by executing the following command

Restart my distro by executing the following command

After the system is restarted then I am enter into the raid directory and list the directory all the datas from the raid is corrupted

[email protected]:~# cd raid/ [email protected]:~/raid# ls -la total 8 drwxr-xr-x 2 root root 4096 Jan 19 15:50 . drwxr------ 5 root root 4096 Jan 19 15:54 . . 

With this method, to configure and test RAID 0 on Linux Mint 20 is comes to an end.

Источник

Оцените статью
Adblock
detector