User Tools

Site Tools


linux:raid

RAID

Dokumentasi seputar RAID lengkap kami tulis disini

1. Membuat RAID 1 SDC & SDD

Membuat raid array full size dan berikut ini tahapannya

1.1 Format Hardisk

fdisk /dev/sdc

ikuti opsi ini

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-8910, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-8910, default 8910): ( langsung enter apabila full size )

Kemudian tampilkan hasilnya

Command (m for help): p
Disk /dev/sdc: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000923aa

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       30401   244196001   83  Linux

Aktifkan partisi sebagai Raid Auto Detect

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help): p

Disk /dev/sdc: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000923aa

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       30401   244196001   fd  Linux raid autodetect
Partition 1 does not start on physical sector boundary.

Lakukan hal yang sama seperti diatas pada SDD

1.2 Buat RAID Array

Lihat dulu partisi array yang ada pastikan jangan sampai bentrok

cat /proc/mdstat

hasilnya

Personalities : [raid1]
md1 : active raid1 sda3[0] sdb3[1]
      306880 blocks super 1.1 [2/2] [UU]

md0 : active raid1 sda1[0] sdb1[1]
      614336 blocks super 1.0 [2/2] [UU]

md127 : active (auto-read-only) raid1 sda4[0] sdb4[1]
      2826812224 blocks super 1.1 [2/2] [UU]
        resync=PENDING
      bitmap: 22/22 pages [88KB], 65536KB chunk

md2 : active raid1 sdb2[1] sda2[0]
      102334336 blocks super 1.1 [2/2] [UU]
      bitmap: 1/1 pages [4KB], 65536KB chunk

anda bisa menggunakan misalnya md3 caranya

mdadm --create /dev/md3 --level=1 --raid-devices=2 /dev/sdc1 /dev/sdd1

dan pantau perubahannya

watch cat /proc/mdstat

dan hasilnya

Personalities : [raid1]
md3 : active raid1 sdd1[1] sdc1[0]
      244064896 blocks super 1.2 [2/2] [UU]
      [======>..............]  resync = 34.6% (84689728/244064896) finish=19.7min speed=134492K/sec
      bitmap: 2/2 pages [8KB], 65536KB chunk

md1 : active raid1 sda3[0] sdb3[1]
      306880 blocks super 1.1 [2/2] [UU]

md0 : active raid1 sda1[0] sdb1[1]
      614336 blocks super 1.0 [2/2] [UU]

md127 : active (auto-read-only) raid1 sda4[0] sdb4[1]
      2826812224 blocks super 1.1 [2/2] [UU]
        resync=PENDING
      bitmap: 22/22 pages [88KB], 65536KB chunk

md2 : active raid1 sdb2[1] sda2[0]
      102334336 blocks super 1.1 [2/2] [UU]
      bitmap: 0/1 pages [0KB], 65536KB chunk

1.3 Mengganti Hardisk RAid

Apabila anda sudah menambahkan hardisk baru /dev/sdb maka cara menambahkan hdd tsb ke raid adalah sbb

Anda tidak perlu melakukan partisi satu per satu, untuk membuat partisi /dev/sdb sama dengan partisi /dev/sda anda bisa menggunakan perintah sfdisk berikut ini

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

Selanjutnya lihat hasilnya dengan

lsblk

setelah anda yakin partisinya sama, selanjutnya tambahkan ke raid, misalnya

mdadm --manage /dev/md0 --add /dev/sdb1

lakukan sesuai dengan partisi yang ada dalam raid.

Menghapus Raid

Berikut ini tahapan menghapus raid

mdadm --stop /dev/md1

lalu

mdadm --remove /dev/md1

jika anda mendapati error

mdadm: error opening md1: No such file or directory

maka lakukan

mdadm --zero-superblock /dev/sdf1 /dev/sde1

sesuai disk raid anda

Mengaktifkan dan Mendisable Raid

mdadm --manage /dev/md1 --fail /dev/sdb2

baru ini

mdadm --manage /dev/md1 --remove /dev/sdb2

mengaktifkan kembali

mdadm -a /dev/md1 /dev/sdb2 

Menghentikan Raid Sync

echo "idle" > /sys/block/md0/md/sync_action

2. Referensi

Layanan

Harga Domain .COM | Harga Domain .ID | Shared Hosting | Email Hosting | MySQL Hosting |
linux/raid.txt · Last modified: 2021/12/05 21:32 by kbadmin

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki