Home » Uncategorized

Remove hardisk dari RAID software

26 September 2012 No Comment

Nota untuk diri sendiri. Selalu gak buat tapi tak hafal command. Malas.

Bagi server engineer yang selalu buat kerja-kerja penyelenggaraan mesti biasa dengan RAID. Ada 2 jenis RAID sama ada RAID software atau hardware.

Kita tidak boleh cabut terus hard disk dari RAID array, kita perlu tag hard disk tersebut sebagai fail dahulu dan kemudian remove dari RAID array.

Contoh aku;

mdadm –fail /dev/md0 /dev/sdb1
mdadm –remove /dev/md0 /dev/sdb1
mdadm –fail /dev/md1 /dev/sdb2
mdadm –remove /dev/md1 /dev/sdb2
mdadm –fail /dev/md2 /dev/sdb3
mdadm –remove /dev/md2 /dev/sdb3

Boleh gak run dengan satu command;

mdadm /dev/md0 –fail /dev/sda1 –remove /dev/sda1

Untuk buat partition yang sebijik sama dengan partition asal command dibawah boleh dipakai;

sfdisk -d /dev/sda | sfdisk /dev/sdb

Ia akan menyalin partition table sda dan membuang sepenuhnya partition table dalam sdb.

Command untuk tengok RAID tengah rebuild;

root@svr30 [~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb1[1] sda1[0]
200704 blocks [2/2] [UU]

md1 : active raid1 sdb2[1] sda2[0]
20482752 blocks [2/2] [UU]

md2 : active raid1 sdb3[1] sda3[0]
956076224 blocks [2/2] [UU]
[=>……………….] resync = 9.6% (92591104/956076224)
finish=1528.7min speed=9413K/sec

Salah satu server yang fail RAID.

root@svr37 [~]# mdadm –detail /dev/md2
/dev/md2:
Version : 0.90
Creation Time : Wed Jan  4 08:00:12 2012
Raid Level : raid1
Array Size : 956076224 (911.79 GiB 979.02 GB)
Used Dev Size : 956076224 (911.79 GiB 979.02 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 2
Persistence : Superblock is persistent

Update Time : Wed Sep 26 18:11:54 2012
State : clean, degraded, recovering
Active Devices : 1
Working Devices : 2
Failed Devices : 0
Spare Devices : 1

Rebuild Status : 7% complete

UUID : 43024e1e:4070316a:ce66b5dd:5afe4cc3
Events : 0.1080400

Number   Major   Minor   RaidDevice State
0       8        3        0      active sync   /dev/sda3
2       8       19        1      spare rebuilding   /dev/sdb3

root@svr37 [~]# mdadm –fail /dev/md2 /dev/sdb3
mdadm: set /dev/sdb3 faulty in /dev/md2
root@svr37 [~]# mdadm –remove /dev/md2 /dev/sdb3
mdadm: hot removed /dev/sdb3
root@svr37 [~]# mdadm –detail /dev/md2
/dev/md2:
Version : 0.90
Creation Time : Wed Jan  4 08:00:12 2012
Raid Level : raid1
Array Size : 956076224 (911.79 GiB 979.02 GB)
Used Dev Size : 956076224 (911.79 GiB 979.02 GB)
Raid Devices : 2
Total Devices : 1
Preferred Minor : 2
Persistence : Superblock is persistent

Update Time : Wed Sep 26 18:13:20 2012
State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 0
Spare Devices : 0

UUID : 43024e1e:4070316a:ce66b5dd:5afe4cc3
Events : 0.1080456

Number   Major   Minor   RaidDevice State
0       8        3        0      active sync   /dev/sda3
1       0        0        1      removed

Command untuk tengok nombor siri hardisk bagi memudahkan penukaran hardisk.

root@svr37 [~]# hdparm -I /dev/sdb | grep Serial
Serial Number:      WD-WCATR8606779
Transport: Serial, SATA 1.0a, SATA II Extensions, SATA Rev 2.5

 



Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.