今更ながら、、便利な sysv-rc-conf [Linux コマンド・設定 Memo]
ubuntuでは init.d から upstart へ移行しようとしているさなか、
本当に今更ながらですが、sysv-rc-conf を初めて使いました。
サービスのon/offを簡単に設定できる上、一覧で確認できるため
視覚的にも、便利です。
なんで今まで使っていなかったのかしら?
コマンドって一度使い込むと、新しいコマンドを覚えるのが億劫になる。
きっとそんな悪循環5年くらい経て、やっと覚えたら(今)、そんなの
もう化石ってことに。。
ubuntu 10.04 (lucid)でRAIDアレイのフォーマット時にstride,stripe widthが自動的に設定される [LinuxでSoftware RAID]
ubuntu 10.04 をインストールして、RAID10を構築して、
アレイをフォーマットするときに気づいたのですが、
# mke2fs -t ext4 -m 0 -b 4096 /dev/md0
mke2fs 1.41.11 (14-Mar-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=16 blocks, Stripe width=32 blocks
244195328 inodes, 976756736 blocks
0 blocks (0.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
29809 block groups
32768 blocks per group, 32768 fragments per group
8192 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, 512000000, 550731776, 644972544
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
と明示的に、strideとstripe widthが表示されている。
念のため、
# tune2fs -l /dev/md0
tune2fs 1.41.11 (14-Mar-2010)
Filesystem volume name: <none>
Last mounted on: <not available>
Filesystem UUID: b6635da4-1919-488c-9764-2f7df12956ee
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags: signed_directory_hash
Default mount options: (none)
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 244195328
Block count: 976756736
Reserved block count: 0
Free blocks: 961379586
Free inodes: 244195317
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 791
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 8192
Inode blocks per group: 512
RAID stride: 16
RAID stripe width: 32
Flex block group size: 16
Filesystem created: Sun May 16 01:30:25 2010
Last mount time: n/a
Last write time: Sun May 16 01:36:16 2010
Mount count: 0
Maximum mount count: 29
Last checked: Sun May 16 01:30:25 2010
Check interval: 15552000 (6 months)
Next check after: Fri Nov 12 01:30:25 2010
Lifetime writes: 58 GB
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 256
Required extra isize: 28
Desired extra isize: 28
Journal inode: 8
Default directory hash: half_md4
Directory Hash Seed: f0d91a46-c6bc-48b8-837b-c9c7a086e9a6
Journal backup: inode blocks
やはり、しかるべき値にちゃんと設定されているようです。
lucidでmke2fsが0.2バージョンアップしたからか、
他に原因があるかは調べていませんが。。
思い当たるところでは、パーティションをfdiskで切り直したくらいかな。
partedすると、
(parted) mkpart
Partition name? []?
File system type? [ext2]?
Start? 0
End? 2000GB
Warning: The resulting partition is not properly aligned for best performance.
とか言われるので、じゃ、ってことで、mklabel で msdos(=mbr)にしておいてから、
fdiskでパーティションを切り直しました。
これをやっておかないと、
WARNING: GPT (GUID Partition Table) detected on '/dev/sda'!
The util fdisk doesn't support GPT. Use GNU Parted.
とか言われますんで。
で、ふつうにfdiskすると、また、
# fdisk /dev/sdaWARNING: DOS-compatible mode is deprecated.
It's strongly recommended to switch off the mode (command 'c') and
change display units to sectors (command 'u').
とか言われるので、
# fdisk -uc /dev/sda
Command (m for help): pDisk /dev/sda: 2000.4 GB,
2000398934016 bytes255 heads, 63 sectors/track, 243201 cylinders,
total 3907029168 sectorsUnits = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0004d1e9
Device Boot Start End Blocks Id System
と、-ucオプションをつけて。
RAID構築したと思いきや、degradしていたとき。。 [LinuxでSoftware RAID]
# mdadm --create /dev/md0 --raid-devices=4 --level=raid10 -v /dev/sd[abcd]1
として、RAID10を構築をはじめて、、およそ5時間後、構築できたことを確認してみると。。
# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90
Creation Time : Sat May 15 05:54:27 2010
Raid Level : raid10
Array Size : 3907026944 (3726.03 GiB 4000.80 GB)
Used Dev Size : 1953513472 (1863.02 GiB 2000.40 GB)
Raid Devices : 4
Total Devices : 4
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Sat May 15 10:53:31 2010
State : active, degraded
Active Devices : 2
Working Devices : 2
Failed Devices : 2
Spare Devices : 0
Layout : near=2, far=1
Chunk Size : 64K
UUID : f2c36e62:2b9db247:86b54b3f:1d0c4af0 (local to host fs)
Events : 0.21
Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 0 0 1 removed
2 8 33 2 active sync /dev/sdc1
3 0 0 3 removed
4 8 49 - faulty spare /dev/sdd1
5 8 17 - faulty spare /dev/sdb1
え〜。degradeしてるじゃないですか、って。。
いちおsyslogみると、
May 15 09:56:40 fs kernel: [16066.137942] end_request: I/O error, dev sdd, sector 2262970368
May 15 09:56:40 fs kernel: [16066.138010] raid10: Disk failure on sdd1, disabling device.
May 15 09:56:40 fs kernel: [16066.138013] raid10: Operation continuing on 3 devices.
May 15 09:56:40 fs kernel: [16066.138225] sd 5:0:0:0: [sdd] Unhandled error code
May 15 09:56:40 fs kernel: [16066.138228] sd 5:0:0:0: [sdd] Result: hostbyte=DID_OK driverbyte=DRIVER_TIMEOUT
May 15 09:56:40 fs kernel: [16066.138234] sd 5:0:0:0: [sdd] CDB: Write(10): 2a 00 86 e2 34 00
May 15 09:56:40 fs kernel: [16066.138244] md: md0: resync done.
あ〜、なんかイヤなかんじです。
# badblocks -vs -o sdb1.bad /dev/sdb1
# badblocks -vs -o sdd1.bad /dev/sdd1
で、不良セクタのチェックを行ってもいいのですが、時間が掛かりそうなので、
試しに、スーパーブロックを初期化して、リビルドします。
# mdadm --manage /dev/md0 --remove /dev/sd[bd]1
# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90
Creation Time : Sat May 15 05:54:27 2010
Raid Level : raid10
Array Size : 3907026944 (3726.03 GiB 4000.80 GB)
Used Dev Size : 1953513472 (1863.02 GiB 2000.40 GB)
Raid Devices : 4
Total Devices : 2
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Sat May 15 14:17:41 2010
State : active, degraded
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Layout : near=2, far=1
Chunk Size : 64K
UUID : f2c36e62:2b9db247:86b54b3f:1d0c4af0 (local to host fs)
Events : 0.23
Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 0 0 1 removed
2 8 33 2 active sync /dev/sdc1
3 0 0 3 removed
# mdadm --misc --zero-superblock /dev/sd[bd]1
# mdadm --manage /dev/md0 --add /dev/sd[bd]1
# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90
Creation Time : Sat May 15 05:54:27 2010
Raid Level : raid10
Array Size : 3907026944 (3726.03 GiB 4000.80 GB)
Used Dev Size : 1953513472 (1863.02 GiB 2000.40 GB)
Raid Devices : 4
Total Devices : 4
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Sat May 15 14:18:28 2010
State : active, degraded, recovering
Active Devices : 2
Working Devices : 4
Failed Devices : 0
Spare Devices : 2
Layout : near=2, far=1
Chunk Size : 64K
Rebuild Status : 0% complete
UUID : f2c36e62:2b9db247:86b54b3f:1d0c4af0 (local to host fs)
Events : 0.25
Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
5 8 17 1 spare rebuilding /dev/sdb1
2 8 33 2 active sync /dev/sdc1
3 0 0 3 removed
4 8 49 - spare /dev/sdd1
って、リビルドって、一個ずつなのね(^^;)
5時間後。。
# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90
Creation Time : Sat May 15 05:54:27 2010
Raid Level : raid10
Array Size : 3907026944 (3726.03 GiB 4000.80 GB)
Used Dev Size : 1953513472 (1863.02 GiB 2000.40 GB)
Raid Devices : 4
Total Devices : 4
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Sat May 15 19:47:59 2010
State : active, degraded, recovering
Active Devices : 3
Working Devices : 4
Failed Devices : 0
Spare Devices : 1
Layout : near=2, far=1
Chunk Size : 64K
Rebuild Status : 0% complete
UUID : f2c36e62:2b9db247:86b54b3f:1d0c4af0 (local to host fs)
Events : 0.42
Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 8 17 1 active sync /dev/sdb1
2 8 33 2 active sync /dev/sdc1
4 8 49 3 spare rebuilding /dev/sdd1
さらに5時間後。
# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90
Creation Time : Sat May 15 05:54:27 2010
Raid Level : raid10
Array Size : 3907026944 (3726.03 GiB 4000.80 GB)
Used Dev Size : 1953513472 (1863.02 GiB 2000.40 GB)
Raid Devices : 4
Total Devices : 4
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Sun May 16 01:21:37 2010
State : active
Active Devices : 4
Working Devices : 4
Failed Devices : 0
Spare Devices : 0
Layout : near=2, far=1
Chunk Size : 64K
UUID : f2c36e62:2b9db247:86b54b3f:1d0c4af0 (local to host fs)
Events : 0.59
Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 8 17 1 active sync /dev/sdb1
2 8 33 2 active sync /dev/sdc1
3 8 49 3 active sync /dev/sdd1
時間掛かったなぁ〜