(1)/mnt/hda5、/mnt/hda6 のバックアップ
landisk:/etc/init.d# df -k
Filesystem 1K-ブロック 使用 使用可 使用% マウント位置
rootfs 396608 278276 114237 71% /
/dev/root 396608 278276 114237 71% /
/dev/shm 63264 4196 59068 7% /mnt/ram0
tmpfs 63264 0 63264 0% /dev/shm
/dev/md1 202208 21784 178340 11% /boot
/dev/md5 202111 5244 194780 3% /mnt/hda5
/dev/md6 478625376 32844 473729980 1% /mnt/hda6
landisk:/etc/init.d# cd /mnt/hda5
landisk:/mnt/hda5# tar czvf /tmp/hda5.tgz .
・・・
landisk:/mnt/hda5# cd /mnt/hda6
landisk:/mnt/hda6# tar czvf /tmp/hda6.tgz .
・・・
(2)念のためバックアップファイルを外部にバックアップ
landisk:/mnt/hda6# ftp www6.plala.or.jp
・・・
ftp> lcd /tmp
Local directory now /mnt/ram0/tmp
ftp> put hda5.tgz
・・・
ftp> put hda6.tgz
・・・
ftp> quit
221 Goodbye.
(3)RAIDの停止とアンマウント
landisk:/tmp# mdadm --stop /dev/md5
landisk:/tmp# mdadm --stop /dev/md6
landisk:/tmp# umount /mnt/hda6
landisk:/tmp# umount /mnt/hda5
landisk:/tmp# df -k
Filesystem 1K-ブロック 使用 使用可 使用% マウント位置
rootfs 396608 278276 114237 71% /
/dev/root 396608 278276 114237 71% /
/dev/shm 63264 4680 58584 8% /mnt/ram0
tmpfs 63264 0 63264 0% /dev/shm
/dev/md1 202208 21784 178340 11% /boot
(4)パーティションの再作成(1TB用への拡張)
landisk:/tmp# fdisk /dev/sda
The number of cylinders for this disk is set to 121601.
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/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 2 27 208845 83 Linux
/dev/sda2 28 78 409657+ 83 Linux
/dev/sda3 79 144 530145 82 Linux swap / Solaris
/dev/sda4 145 60706 486464265 5 Extended
/dev/sda5 145 170 208844+ 83 Linux
/dev/sda6 171 60706 486255419+ 83 Linux
Command (m for help): d
Partition number (1-6): 6
Command (m for help): d
Partition number (1-5): 5
Command (m for help): d
Partition number (1-5): 4
Command (m for help): p
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 2 27 208845 83 Linux
/dev/sda2 28 78 409657+ 83 Linux
/dev/sda3 79 144 530145 82 Linux swap / Solaris
Command (m for help): n
Command action
e extended
p primary partition (1-4)
e
Selected partition 4
First cylinder (1-121601, default 1): 145
Last cylinder or +size or +sizeM or +sizeK (145-121601, default 121601): 121500
Command (m for help): p
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 2 27 208845 83 Linux
/dev/sda2 28 78 409657+ 83 Linux
/dev/sda3 79 144 530145 82 Linux swap / Solaris
/dev/sda4 145 121500 974792070 5 Extended
Command (m for help): n
First cylinder (145-121500, default 145):
Using default value 145
Last cylinder or +size or +sizeM or +sizeK (145-121500, default 121500): 170
Command (m for help): p
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 2 27 208845 83 Linux
/dev/sda2 28 78 409657+ 83 Linux
/dev/sda3 79 144 530145 82 Linux swap / Solaris
/dev/sda4 145 121500 974792070 5 Extended
/dev/sda5 145 170 208813+ 83 Linux
Command (m for help): n
First cylinder (171-121500, default 171):
Using default value 171
Last cylinder or +size or +sizeM or +sizeK (171-121500, default 121500):
Using default value 121500
Command (m for help): p
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 2 27 208845 83 Linux
/dev/sda2 28 78 409657+ 83 Linux
/dev/sda3 79 144 530145 82 Linux swap / Solaris
/dev/sda4 145 121500 974792070 5 Extended
/dev/sda5 145 170 208813+ 83 Linux
/dev/sda6 171 121500 974583193+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: デバイスもしくはリソースがビジー状態です.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
(5)ファイルシステムの作成
前回の換装ではmke2fsを使用しましたが問題が発生し、いろいろ調べたところmkfs.ext3でうまくいきました。
landisk:~# mke2fs -V
mke2fs 1.35 (28-Feb-2004)
Using EXT2FS Library version 1.35
landisk:/sbin# mkfs.ext3 /dev/sda5
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
52208 inodes, 208812 blocks
10440 blocks (5.00%) reserved for the super user
First data block=1
26 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
landisk:/sbin# mkfs.ext3 /dev/sda6
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
121831424 inodes, 243645798 blocks
12182289 blocks (5.00%) reserved for the super user
First data block=0
7436 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
(6)RAIDの構成
landisk:/sbin# mdadm --create /dev/md5 --level=raid1 --raid-devices=2 /dev/sda5 missing
mdadm: /dev/sda5 appears to contain an ext2fs file system
size=208812K mtime=Thu Jan 1 09:00:00 1970
mdadm: /dev/sda5 appears to be part of a raid array:
level=1 devices=2 ctime=Sat May 17 13:41:05 2008
Continue creating array? y
mdadm: array /dev/md5 started.
landisk:/sbin# mdadm --create /dev/md6 --level=raid1 --raid-devices=2 /dev/sda6 missing
mdadm: /dev/sda6 appears to contain an ext2fs file system
size=974583192K mtime=Thu Jan 1 09:00:00 1970
mdadm: /dev/sda6 appears to be part of a raid array:
level=1 devices=2 ctime=Sat May 17 13:41:18 2008
Continue creating array? y
mdadm: array /dev/md6 started.
landisk:/sbin# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid5]
md6 : active raid1 sda6[0]
974583104 blocks [2/1] [U_]
md5 : active raid1 sda5[0]
208704 blocks [2/1] [U_]
md2 : active raid1 sda2[0]
409536 blocks [2/1] [U_]
md1 : active raid1 sda1[0]
208768 blocks [2/1] [U_]
unused devices: <none>
(7)RAIDファイルシステムの作成
landisk:/sbin# mke2fs -j -m1 /dev/md5
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
52208 inodes, 208704 blocks
2087 blocks (1.00%) reserved for the super user
First data block=1
26 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
landisk:/sbin# mke2fs -j -m1 /dev/md6
・・・
(8)RAIDファイルシステムのマウント
landisk:/sbin# mount /mnt/hda5
landisk:/sbin# mount /mnt/hda6
(9)データリストア
3.(1)でバックアップしたデータのリストア