Software RAID Ubuntu

Step 1: Prepare the Disks:
http://forum.niit.vn/showthread.php?t=9201
http://vozforums.com/showthread.php?t=149812
http://ultimateedition.info/
root@iscsi:/# fdisk -l
Disk /dev/sda: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000185b0
Device Boot Start End Blocks Id System
/dev/sda1 * 1 617 4956021 83 Linux
/dev/sda2 618 652 281137+ 5 Extended
/dev/sda5 618 652 281106 82 Linux swap / Solaris

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x90f9feaa
Device Boot Start End Blocks Id System
/dev/sdb1 1 1044 8385898+ 7 HPFS/NTFS
Disk /dev/sdc: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x4430ddbd
Device Boot Start End Blocks Id System
/dev/sdc1 1 131 1052226 7 HPFS/NTFS
/dev/sdc2 132 2610 19912567+ 7 HPFS/NTFS

Disk /dev/sdd: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000
Disk /dev/sdd doesn't contain a valid partition table
Disk /dev/sde: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000
Disk /dev/sde doesn't contain a valid partition table
Disk /dev/sdf: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000
Disk /dev/sdf doesn't contain a valid partition table
root@iscsi:/#
Step 2: Creating the md Device using mdadm (Mirrored Device Admin)
Cài bộ quản lý mdadm
Trích:
sudo apt-get install mdadm
tạo device (ở đây mình dùng hẳn 1 hard disk; nếu các bạn dùng 1 partition thì thêm số vào sau tương ứng, sda1, sdb1, ...)
Trích:
sudo mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sdd /dev/sde /dev/sdf
Tạo file Config:
Trích:
sudo echo "DEVICE partitions" > /etc/mdadm/mdadm.conf
sudo mdadm --detail --scan >> /etc/mdadm/mdadm.conf
Tạo file system
Trích:
sudo mke2fs -j /dev/md0
Add vào fstab để tự mount khi boot (nhớ tạo thư mục /var/media trước khi mount nhé).
Trích:
/dev/md0 /var/media auto defaults 0 3
Kiểm tra:
Trích:
root@iscsi:/# sudo watch cat /proc/mdstat
Every 2.0s: cat /proc/mdstat Mon Mar 3 00:47:49 2008

Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sde[2] sdd[1] sdf[0]
2097024 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]

unused devices:

Để tăng dung lượng RAID băng cách thêm đĩa:
Trích:
mdadm --add /dev/md0 /dev/sdg
mdadm --grow /dev/md0 --raid-devices=4
resize:
Trích:
fsck.ext2 /dev/md0
resize2fs /dev/md0

Nhận xét

Bài đăng phổ biến từ blog này

Ký tự viết tắt trong chat & email

dung lượng RAM lớn nhất mà HĐH cấu trúc 32-bit nhận được

Ubuntu LAMP Server