Showing posts with label raid. Show all posts
Showing posts with label raid. Show all posts

Thursday, 27 January 2022

RAID Mirrorring with MDADM

So I posted about my RAID solution plenty of times, but I have some additional information.

So here're my current harddrives:

# lsscsi
[0:0:0:0]    disk    ATA      Samsung SSD 860  1B6Q  /dev/sda 
[4:0:0:0]    disk    ATA      WDC WD4003FZEX-0 1A01  /dev/sdb 
[5:0:0:0]    disk    ATA      WDC WD5000AAKS-0 3B01  /dev/sdc 
[5:0:1:0]    disk    ATA      ST2000DM001-1CH1 CC29  /dev/sdd 
[10:0:0:0]   disk    WD       Ext HDD 1021     2021  /dev/sde 
[11:0:0:0]   disk    WD       Ext HDD 1021     2021  /dev/sdf 

Three harddrives of which I use for my RAID 1. One internal SATA drive and two external USB drives.

/dev/sdd - harddrive 2 TB
./dev/sdd1        2048 3907024895 3907022848  1.8T fd Linux raid autodetect

/dev/sde - external WD harddrive 2 TB
/dev/sde1        2048 3907024895 3907022848  1.8T fd Linux raid autodetect

/dev/sdf - external WD harddrive 2 TB
/dev/sdf1        2048 3907024895 3907022848  1.8T fd Linux raid autodetect

And then I had a problem.

# mdadm --detail /dev/md127
/dev/md127:
           Version : 1.2
     Creation Time : Wed Mar  6 22:16:05 2013
        Raid Level : raid1
        Array Size : 1953380160 (1862.89 GiB 2000.26 GB)
     Used Dev Size : 1953380160 (1862.89 GiB 2000.26 GB)
      Raid Devices : 3
     Total Devices : 2
       Persistence : Superblock is persistent

       Update Time : Sat Nov 27 20:57:13 2021
             State : clean, degraded 
    Active Devices : 2
   Working Devices : 2
    Failed Devices : 0
     Spare Devices : 0

Consistency Policy : resync

              Name : micemouse:0
              UUID : ed4531c4:59c132b2:a6bfc3d1:6da3b928
            Events : 6205

    Number   Major   Minor   RaidDevice State
       2       8       65        0      active sync   /dev/sde1
       -       0        0        1      removed
       3       8       49        2      active sync   /dev/sdd1

For some reason, we're missing /dev/sdf with partition /dev/sdf1.

I am fairly concerned here.

So I reattached the device, and then had to rebuild, etc, etc and it took a few days.

mdadm /dev/md127 -a /dev/sdf1

A better solution would have been to prevent the automounting of raid arrays, until I've attached said external drives.

They are not attached by default.

Turning off auto raid detection

The reason I wanted to turn off automatic raid detection, is because I have two disks that can be attached via USB that are part of the RAID array.

When they are not attached, and the raid is autodetected, this time it started up with one device removed.

And it takes a dickens of a time to reattach the devices to the raid.

Sometimes the configuration is simply not there (autodetects the superblock on drives, and works it out from there).

If it is there, it should be either in:

/etc/mdadm/mdadm.conf
for some Linux, for example Ubuntu.
/etc/mdadm.conf
for some Linux, for example Fedora.

Simply adding the following should be enough:

echo "AUTO -all" >> /etc/mdadm.conf

A better way would probably be to have stopped the raid, and re-assemble it again.

Will try this next time if it happens.

Stopping an array

sudo umount /mnt/md127
sudo mdadm --stop --scan

Starting an Array

For simple setups:

sudo mdadm --assemble --scan

For specific setups:

sudo mdadm --assemble /dev/md127 /dev/sdd /dev/sde /dev/sdf

For machine/harddrive independent setup (he gathers the appropriate components itself):

mdadm --scan --assemble --uuid=a26bf396:31389f83:0df1722d:f404fe4c

And then you can do:

sudo mount /dev/md127 /mnt/raid

References

DigitalOcean - How To Manage RAID Arrays with mdadm on Ubuntu 16.04
https://www.digitalocean.com/community/tutorials/how-to-manage-raid-arrays-with-mdadm-on-ubuntu-16-04
Re: turn off auto assembly
https://www.spinics.net/lists/raid/msg30997.html

Thursday, 30 December 2021

Standard RAID levels

I needed to put this information somewhere for easy access.

striping
different parts are on different harddisks, advantage: faster, as accessing several disks at once to gather all, disadvantage: a failure causes the entire data to be unrecoverable.
mirroring
an exact copy over multiple harddisks
parity
parity bits help check that the data is unlikely to have faults, see checksum. Can even be used to in cases to recover from faults.

Different RAID levels

RAID 0
striping, increased performance without parity information, redundancy, or fault tolerance
RAID 1
mirroring, no striping or parity
RAID 2
mostly unused, academic
RAID 3
byte-level striping with a parity disk
RAID 4
block-level striping with a dedicated parity disk
RAID 5
block-level striping with distributed parity
RAID 6
block-level striping with two parity blocks distributed across all member disks
RAID 10
raid 1 and 0 together

The Wikipedia article in the references provides more in depth information.

It is obvious for my use that I am solely interested in RAID 1, the mirroring solution.

My primary reason is the fault tolerance of data. The fact that reads perform better is not a big thing, and the disadvantage of space inefficiency I'll accept.

References

Wikipedia - Standard RAID levels
https://en.wikipedia.org/wiki/Standard_RAID_levels

Thursday, 20 December 2018

Harddisks

I'm getting more and more harddisks in my computer nowadays. Some are really old, some I've managed to appropriate from family members, and of course when I upgraded to SSD, one more harddisk was added.

It's hard to keep them all straight, so I'm writing this stuff down.

For historical purposes, I guess.

It will be split up into "The New" and "The Old".

"The Old" being the original partition information at the time of acquirement.

The New

ATA Samsung SSD 860500 GBsda
The Operating System and everything essential.
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 1026047 1024000 500M 7 HPFS/NTFS/exFAT
/dev/sda2 1026048 771002103 769976056 367.2G 7 HPFS/NTFS/exFAT
/dev/sda3 771002368 771969023 966656 472M 27 Hidden NTFS WinRE
/dev/sda4 771971072 976773119 204802048 97.7G 83 Linux

ATA WDC WD4003FZEX-04 TBsdb
Very important data regarding the /home directories.
DeviceStartEndSectorsSizeType
/dev/sdb12048409520481MBIOS boot
/dev/sdb2409610280951024000500MLinux filesystem
/dev/sdb31028096527343750052724094052.5TLinux filesystem
/dev/sdb45273438208742092185521474836481TLinux filesystem

ATA WDC WD5000AAKS-0500 GBsdc
Still empty for now.
DeviceBootStartEndSectorsSizeIdType
/dev/sdc12048976773167976771120465.8G83Linux

ATA ST2000DM001-1CH12 TBsdd
An old harddrive of my mother-in-law, part of a raid now.
DeviceBootStartEndSectorsSizeIdType
/dev/sdd1 2048 3907024895 3907022848 1.8T fd Linux raid autodetect

The Old

ATA Samsung SSD 860500 GBsda
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 1026047 1024000 500M 7 HPFS/NTFS/exFAT
/dev/sda2 1026048 771002103 769976056 367.2G 7 HPFS/NTFS/exFAT
/dev/sda3 771002368 771969023 966656 472M 27 Hidden NTFS WinRE
/dev/sda4 771971072 976773119 204802048 97.7G 83 Linux

ATA WDC WD4003FZEX-04 TBsdb
DeviceStartEndSectorsSizeType
/dev/sdb12048409520481MBIOS boot
/dev/sdb2409610280951024000500MLinux filesystem
/dev/sdb31028096527343750052724094052.5TLinux filesystem
/dev/sdb45273438208742092185521474836481TLinux filesystem
/dev/sdb574209218567630637055209715200100GLinux filesystem
/dev/sdb67630637056763804467174076163.5GLinux swap

ATA WDC WD5000AAKS-0500 GBsdc
DeviceBootStartEndSectorsSizeIdType
/dev/sdc1*204820290317820290113196.8G7HPFS/NTFS/exFAT
/dev/sdc2202903552203876351972800475M27Hidden NTFS WinRE
/dev/sdc3203878400204799999921600450M27Hidden NTFS WinRE
/dev/sdc4204802048414517247209715200100G83Linux

ATA ST2000DM001-1CH12 TBsdd
DeviceBootStartEndSectorsSizeIdType
/dev/sdd1*204810240204710240000048.8G7HPFS/NTFS/exFAT
/dev/sdd21024020482000568319765478446.6G83Linux
/dev/sdd320005683220535418871853485056883.8Gfd Linux raid autodetect
/dev/sdd4205354188839070269431853485056883.8Gfd Linux raid autodetect

References

Binary Tides - 9 commands to check hard disk partitions and disk space on Linux
https://www.binarytides.com/linux-command-check-disk-partitions/