Geschrieben von Frank Mankel
Kategorie: NAS

Irgendwie liegen hier zu viele HDD's rum, kommt wahrscheinlich davon wenn man alle HDD's gegen SSD's austauscht ;) Gut wenn man noch Verwendung dafür hat. Da kam mir irgendwann die Idee, die HDD 1TB dem RAID1 in meinem NAS hinzuzufügen. Los geht's...

Spare3.jpg

 

NAS runterfahren und die HDD einbauen. System wieder starten, Passwort eingeben. Nachschauen ob die Festplatte vorhanden ist.

root@nas:/home/frank# fdisk -l
Disk /dev/sda: 931,5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x0001e9dd
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 1953525167 1953523120 931,5G fd Linux raid autodetect

Disk /dev/sdb: 931,5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x00079852
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 1953525167 1953523120 931,5G fd Linux raid autodetect

Disk /dev/sdc: 28 GiB, 30016659456 bytes, 58626288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x055361e8
Device Boot Start End Sectors Size Id Type
/dev/sdc1 * 2048 56145919 56143872 26,8G 83 Linux
/dev/sdc2 56147966 58626047 2478082 1,2G 5 Extended
/dev/sdc5 56147968 58626047 2478080 1,2G 82 Linux swap / Solaris

Disk /dev/sdd: 931,5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x0001e9dd
Device Boot Start End Sectors Size Id Type
/dev/sdd1 2048 1953525167 1953523120 931,5G 83 Linux

Disk /dev/md0: 931,4 GiB, 1000069595136 bytes, 1953260928 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/mapper/nas: 931,4 GiB, 1000067497984 bytes, 1953256832 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Mal den Status vom RAID ansehen.

root@nas:/home/frank# cat /proc/mdstat 
Personalities : [raid1]
md0 : active raid1 sda1[0] sdb1[1]
976630464 blocks super 1.2 [2/2] [UU]
bitmap: 0/8 pages [0KB], 65536KB chunk
unused devices: <none>

Die HDD dem RAID hinzufügen.

root@nas:/home/frank# mdadm --add /dev/md0 /dev/sdd1
mdadm: added /dev/sdd1

Status:

root@nas:/home/frank# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdd1[2](S) sda1[0] sdb1[1]
976630464 blocks super 1.2 [2/2] [UU]
bitmap: 0/8 pages [0KB], 65536KB chunk

unused devices: <none>

Der Status etwas ausführlicher.

root@nas:/home/frank# mdadm --query --detail /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Thu Oct 20 18:33:38 2016
Raid Level : raid1
Array Size : 976630464 (931.39 GiB 1000.07 GB)
Used Dev Size : 976630464 (931.39 GiB 1000.07 GB)
Raid Devices : 2
Total Devices : 3
Persistence : Superblock is persistent
Intent Bitmap : Internal
Update Time : Tue Jan 31 20:00:46 2017
State : clean
Active Devices : 2
Working Devices : 3
Failed Devices : 0
Spare Devices : 1
Name : nas:0 (local to host nas)
UUID : 93ca2944:fd58a3fb:2d5cc1c8:269aab6d
Events : 2908
Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 8 17 1 active sync /dev/sdb1
2 8 49 - spare /dev/sdd1

Hier kann man jetzt schön sehen, das das RAID eine zusätzliche HDD enthält, die als Reserve vorgehalten wird. Sollte eine Platte des RAID's ausfallen, wird nun automatisch die Ersatzplatte eingebunden. Jetzt mal Gedanken machen, ob ich das mal simulieren möchte!???

HDParm:

Noch schnell die HDD einstellen, so das sie sich schlafen legt wenn sie nich benötigt wird. Wir brauchen die ID.

root@nas:/dev/disk/by-id# ls
ata-ST1000LM024_HN-M101MBB_xxxxxxxxxxxxxxx

Konfig bearbeiten.

Das hier ans Ende einfügen.

/dev/disk/by-id/ata-ST1000LM024_HN-M101MBB_xxxxxxxxxxxxxxx {
# mult_sect_io = 16
# write_cache = off
# dma = on
spindown_time = 240
}

NAS neustarten - Fertig!

Wie das RAID1 eingerichtet wird, hatte ich hier beschrieben. Projekt NAS - Software

Und wie immer, Datenverluste sind Eure! :)