Slackware Linux 8.0.0  既存HDDをRAID1化 構築メモ

既存のパーティションの確認
root@:~# fdisk /dev/hda
The number of cylinders for this disk is set to 9726.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/hda: 255 heads, 63 sectors, 9726 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 33 265041 fd Linux raid autodetect
/dev/hda2 34 98 522112+ 82 Linux swap
/dev/hda3 99 162 514080 83 Linux native
/dev/hda4 163 9726 76822830 5 Extended
/dev/hda5 163 188 208813+ 83 Linux native
/dev/hda6 189 213 200781 83 Linux native
/dev/hda7 214 239 208813+ 83 Linux native
/dev/hda8 240 1544 10482381 83 Linux native
/dev/hda9 1545 1551 56196 83 Linux native
/dev/hda10 1552 2791 9960268+ 83 Linux native
/dev/hda11 2792 5402 20972826 83 Linux native
/dev/hda12 5403 8013 20972826 83 Linux native
/dev/hda13 8014 9726 13759641 83 Linux native
Command (m for help):
RAID コンフィグ作成
vi /etc/raidtab
raiddev /dev/md0
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda1
failed-disk 0
device /dev/hdb1
raid-disk 1
raiddev /dev/md1
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda2
failed-disk 0
device /dev/hdb2
raid-disk 1
raiddev /dev/md2
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda3
failed-disk 0
device /dev/hdb3
raid-disk 1
raiddev /dev/md3
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda5
failed-disk 0
device /dev/hdb5
raid-disk 1
raiddev /dev/md4
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda6
failed-disk 0
device /dev/hdb6
raid-disk 1
raiddev /dev/md5
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda7
failed-disk 0
device /dev/hdb7
raid-disk 1
raiddev /dev/md6
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda8
failed-disk 0
device /dev/hdb8
raid-disk 1
raiddev /dev/md7
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda9
failed-disk 0
device /dev/hdb9
raid-disk 1
raiddev /dev/md8
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda10
failed-disk 0
device /dev/hdb10
raid-disk 1
raiddev /dev/md9
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda11
failed-disk 0
device /dev/hdb11
raid-disk 1
raiddev /dev/md10
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda12
failed-disk 0
device /dev/hdb12
raid-disk 1
raiddev /dev/md11
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda13
failed-disk 0
device /dev/hdb13
raid-disk 1
RAIDデバイス作成
root@ :~# mkraid /dev/md0   
handling MD device /dev/md0
analyzing super-block
disk 0: /dev/hda1, failed
disk 1: /dev/hdb1, 265041kB, raid superblock at 264960kB
/dev/hdb1 appears to contain an ext2 filesystem — use -f to override
mkraid: aborted, see the syslog and /proc/mdstat for potential clues.
強制的に作成
できないときにはエラーログと
本当に強制的にmkraidするオプションが表示される。
本当に強制的に作成
コマンドを入力すると・・
DESTROYING the contents of /dev/md0 in 5 seconds, Ctrl-C if unsure!
handling MD device /dev/md0
analyzing super-block
disk 0: /dev/hda1, failed
disk 1: /dev/hdb1, 265041kB, raid superblock at 264960kB
RAIDの状態
root@ :~# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid5]
read_ahead 1024 sectors
md11 : active raid1 hdb13[1]
13759552 blocks [2/1] [_U]
md10 : active raid1 hdb12[1]
20972736 blocks [2/1] [_U]
md9 : active raid1 hdb11[1]
20972736 blocks [2/1] [_U]
md8 : active raid1 hdb10[1]
9960192 blocks [2/1] [_U]
md7 : active raid1 hdb9[1]
56128 blocks [2/1] [_U]
md6 : active raid1 hdb8[1]
10482304 blocks [2/1] [_U]
md5 : active raid1 hdb7[1]
208704 blocks [2/1] [_U]
md4 : active raid1 hdb6[1]
200704 blocks [2/1] [_U]
md3 : active raid1 hdb5[1]
208704 blocks [2/1] [_U]
md2 : active raid1 hdb3[1]
513984 blocks [2/1] [_U]
md0 : active raid1 hdb1[1]
264960 blocks [2/1] [_U]
md1 : active raid1 hdb2[1]
522048 blocks [2/1] [_U]
unused devices:
 
 パーティションのIDをLINUX NATIVEからRAID AUTOに変更
Disk /dev/hdb: 255 heads, 63 sectors, 9726 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 1 33 265041 fd Linux raid autodetect
/dev/hdb2 34 98 522112+ fd Linux raid autodetect
/dev/hdb3 99 162 514080 fd Linux raid autodetect
/dev/hdb4 163 9726 76822830 5 Extended
/dev/hdb5 163 188 208813+ 83 Linux native
/dev/hdb6 189 213 200781 83 Linux native
/dev/hdb7 214 239 208813+ 83 Linux native
/dev/hdb8 240 1544 10482381 83 Linux native
/dev/hdb9 1545 1551 56196 83 Linux native
/dev/hdb10 1552 2791 9960268+ 83 Linux native
/dev/hdb11 2792 5402 20972826 83 Linux native
/dev/hdb12 5403 8013 20972826 83 Linux native
/dev/hdb13 8014 9726 13759641 83 Linux native
Command (m for help): t
Partition number (1-13): 5
Hex code (type L to list codes): fd
Changed system type of partition 5 to fd (Linux raid autodetect)
Command (m for help): t
Partition number (1-13): 6
Hex code (type L to list codes): fd
Changed system type of partition 6 to fd (Linux raid autodetect)
Command (m for help): t
Partition number (1-13): 7
Hex code (type L to list codes): fd
Changed system type of partition 7 to fd (Linux raid autodetect)
Command (m for help): t
Partition number (1-13): 8
Hex code (type L to list codes): fd
Changed system type of partition 8 to fd (Linux raid autodetect)
Command (m for help): t
Partition number (1-13): 9
Hex code (type L to list codes): fd
Changed system type of partition 9 to fd (Linux raid autodetect)
Command (m for help): t
Partition number (1-13): 10
Hex code (type L to list codes): f
You cannot change a partition into an extended one or vice versa
Delete it first.
Command (m for help): t
Partition number (1-13): 10
Hex code (type L to list codes): fd
Changed system type of partition 10 to fd (Linux raid autodetect)
Command (m for help): t
Partition number (1-13): 11
Hex code (type L to list codes): fd
Changed system type of partition 11 to fd (Linux raid autodetect)
Command (m for help): t
Partition number (1-13): 12
Hex code (type L to list codes): fd
Changed system type of partition 12 to fd (Linux raid autodetect)
Command (m for help): t
Partition number (1-13): 13
Hex code (type L to list codes): fd
Changed system type of partition 13 to fd (Linux raid autodetect)
Command (m for help):
Command (m for help): p
Disk /dev/hdb: 255 heads, 63 sectors, 9726 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 1 33 265041 fd Linux raid autodetect
/dev/hdb2 34 98 522112+ fd Linux raid autodetect
/dev/hdb3 99 162 514080 fd Linux raid autodetect
/dev/hdb4 163 9726 76822830 5 Extended
/dev/hdb5 163 188 208813+ fd Linux raid autodetect
/dev/hdb6 189 213 200781 fd Linux raid autodetect
/dev/hdb7 214 239 208813+ fd Linux raid autodetect
/dev/hdb8 240 1544 10482381 fd Linux raid autodetect
/dev/hdb9 1545 1551 56196 fd Linux raid autodetect
/dev/hdb10 1552 2791 9960268+ fd Linux raid autodetect
/dev/hdb11 2792 5402 20972826 fd Linux raid autodetect
/dev/hdb12 5403 8013 20972826 fd Linux raid autodetect
/dev/hdb13 8014 9726 13759641 fd Linux raid autodetect
Command (m for help):
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Re-read table failed with error 16: Device or resource busy.
Reboot your system to ensure the partition table is updated.
WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
 
 MDデバイスのフォーマット
root@ :~# mke2fs /dev/md1から11
mke2fs 1.22, 22-Jun-2001 for EXT2 FS 0.5b, 95/08/09
warning: 304 blocks unused.
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2626560 inodes, 5242880 blocks
262159 blocks (5.00%) reserved for the super user
First data block=0
160 block groups
32768 blocks per group, 32768 fragments per group
16416 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 34 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
 
 SWAPの作成
root@ :~# mkswap /dev/md1
Setting up swapspace version 1, size = 534573056 bytes
 
 MDをマウントして、コピー
root@ :/mnt#
root@ :/mnt# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda1 251M 64M 176M 27% /
/dev/hda3 486M 417M 49M 90% /opt
/dev/hda5 197M 28M 159M 15% /var
/dev/hda6 190M 15k 180M 1% /tmp
/dev/hda9 53M 5.4M 45M 11% /root
/dev/hda8 9.8G 6.8G 2.6G 72% /usr
/dev/hda13 13G 6.2G 6.2G 50% /export
/dev/hda7 197M 56M 131M 30% /www
/dev/hda11 20G 9.7G 9.0G 52% /home
/dev/hda12 20G 19G 893M 96% /ehome
/dev/md0 251M 22k 237M 1% /mnt
/dev/md2 486M 13k 460M 1% /mnt/opt
/dev/md6 9.8G 20k 9.3G 1% /mnt/usr
/dev/md7 53M 13k 50M 1% /mnt/root
/dev/md9 20G 20k 18G 1% /mnt/home
/dev/md10 20G 20k 18G 1% /mnt/ehome
/dev/md5 197M 13k 187M 1% /mnt/www
/dev/md3 197M 13k 187M 1% /mnt/var
/dev/md4 190M 13k 179M 1% /mnt/tmp
/dev/md11 13G 20k 12G 1% /mnt/export
 
 lilo.conf、fstabの編集
root@ :/etc# cat /etc/lilo.conf
# LILO configuration file
# generated by ‘liloconfig’
#
# Start LILO global section
#boot = /dev/fd0
boot = /dev/hda1
prompt
timeout = 50
default = linux_numa
#compact # faster, but won’t work on all systems.
# delay = 5
# VESA framebuffer console @ 1024x768x64k
vga = 791
# Normal VGA console
# vga = normal
# VESA framebuffer console @ 1024x768x64k
# vga=791
# VESA framebuffer console @ 1024x768x32k
# vga=790
# VESA framebuffer console @ 1024x768x256
# vga=773
# VESA framebuffer console @ 800x600x64k
# vga=788
# VESA framebuffer console @ 800x600x32k
# vga=787
# VESA framebuffer console @ 800x600x256
# vga=771
# VESA framebuffer console @ 640x480x64k
# vga=785
# VESA framebuffer console @ 640x480x32k
# vga=784
# VESA framebuffer console @ 640x480x256
# vga=769
# ramdisk = 0 # paranoia setting
# End LILO global section
# Linux bootable partition config begins
image = /vmlinuz
root = /dev/hda1
label = linux
read-only # Non-UMSDOS filesystems should be mounted read-only for checking
# Linux bootable partition config ends
image = /boot/vmlinuz-2.4.33
root = /dev/hda1
label = linux_numa
read-only # Non-UMSDOS filesystems should be mounted read-only for checking
# Linux bootable partition config ends
image = /boot/vmlinuz-2.4.33
root = /dev/md0
label = linux_numa_RAID
read-only # Non-UMSDOS filesystems should be mounted read-only for checking
# Linux bootable partition config ends
root@ #
root@ :/etc# cat fstab
/dev/md0 / ext2 defaults 1 1
/dev/md1 swap swap defaults 1 1
/dev/md2 /opt ext2 defaults 1 1
/dev/md3 /var ext2 defaults 1 1
/dev/md4 /tmp ext2 defaults 1 1
/dev/md7 /root ext2 defaults 1 1
/dev/md6 /usr ext2 defaults 1 1
/dev/md11 /export ext2 defaults 1 1
/dev/md5 /www ext2 defaults 1 1
/dev/md9 /home ext2 defaults 1 1
/dev/md10 /ehome ext2 defaults 1 1
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
 
 raidtab編集
root@ :/etc# cat raidtab
raiddev /dev/md0
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda1
raid-disk 0
device /dev/hdb1
raid-disk 1
raiddev /dev/md1
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda2
raid-disk 0
device /dev/hdb2
raid-disk 1
raiddev /dev/md2
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda3
raid-disk 0
device /dev/hdb3
raid-disk 1
raiddev /dev/md3
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda5
raid-disk 0
device /dev/hdb5
raid-disk 1
raiddev /dev/md4
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda6
raid-disk 0
device /dev/hdb6
raid-disk 1
raiddev /dev/md5
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda7
raid-disk 0
device /dev/hdb7
raid-disk 1
raiddev /dev/md6
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda8
raid-disk 0
device /dev/hdb8
raid-disk 1
raiddev /dev/md7
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda9
raid-disk 0
device /dev/hdb9
raid-disk 1
raiddev /dev/md8
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda10
raid-disk 0
device /dev/hdb10
raid-disk 1
raiddev /dev/md9
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda11
raid-disk 0
device /dev/hdb11
raid-disk 1
raiddev /dev/md10
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda12
raid-disk 0
device /dev/hdb12
raid-disk 1
raiddev /dev/md11
raid-level 1
persistent-superblock 1
chunk-size 4
nr-raid-disks 2
device /dev/hda13
raid-disk 0
device /dev/hdb13
raid-disk 1
You have mail in /var/spool/mail/root
root@ :/etc#
 raidhotaddで追加する。
 root@ :/etc# raidhotadd /dev/md11 /dev/hda13
/dev/md11: can not hot-add disk: disk busy!
 
root@ :/etc# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid5]
read_ahead 1024 sectors
md13 : active raid1 hda10[1]
9960192 blocks [2/1] [_U]
md0 : active raid1 hda1[0] hdb1[1]
264960 blocks [2/2] [UU]
md1 : active raid1 hda2[0] hdb2[1]
522048 blocks [2/2] [UU]
md2 : active raid1 hda3[2] hdb3[1]
513984 blocks [2/1] [_U]
[======>…………..] recovery = 33.8% (174272/513984) finish=3.1min speed=1796K/sec
md3 : active raid1 hda5[2] hdb5[1]
208704 blocks [2/1] [_U]
md4 : active raid1 hda6[2] hdb6[1]
200704 blocks [2/1] [_U]
md5 : active raid1 hda7[2] hdb7[1]
208704 blocks [2/1] [_U]
md6 : active raid1 hda8[2] hdb8[1]
10482304 blocks [2/1] [_U]
md7 : active raid1 hda9[2] hdb9[1]
56128 blocks [2/1] [_U]
md8 : active raid1 hdb10[1]
9960192 blocks [2/1] [_U]
md9 : active raid1 hda11[2] hdb11[1]
20972736 blocks [2/1] [_U]
md10 : active raid1 hda12[2] hdb12[1]
20972736 blocks [2/1] [_U]
md11 : active raid1 hda13[2] hdb13[1]
13759552 blocks [2/1] [_U]
unused devices:
 
 FSTAB 書き換え (IDEからSATAorMDに変える場合)
 

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です