消えゆく世界と流れる未来に最後の灯を since 2006/4/3
# fdisk /dev/sdc
Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): e
Partition number (1-4, default 1):
First sector (2048-62945279, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-62945279, default 62945279):
Created a new partition 1 of type 'Extended' and of size 30 GiB.
Command (m for help): n
Partition type
p primary (0 primary, 1 extended, 3 free)
l logical (numbered from 5)
Select (default p): l
Adding logical partition 5
First sector (4096-62945279, default 4096):
Last sector, +sectors or +size{K,M,G,T,P} (4096-62945279, default 62945279):
Created a new partition 5 of type 'Linux' and of size 30 GiB.
Command (m for help): t
Partition number (1,5, default 5):
Hex code (type L to list all codes): L
0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 84 OS/2 hidden C: c6 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx
5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data
6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility
8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access
a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O
b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi eb BeOS fs
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD ee GPT
f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ef EFI (FAT-12/16/
10 OPUS 55 EZ-Drive a7 NeXTSTEP f0 Linux/PA-RISC b
11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f1 SpeedStor
12 Compaq diagnost 5c Priam Edisk a9 NetBSD f4 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f2 DOS secondary
16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ fb VMware VMFS
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 75 PC/IX be Solaris boot ff BBT
1e Hidden W95 FAT1 80 Old Minix
Hex code (type L to list all codes): fd
Changed type of partition 'Linux' to 'Linux raid autodetect'.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
長ったらしいので何したかというと、# mdadm -C /dev/md0 -l1 -n2 /dev/sdc5 /dev/sdd5
mdadm: Note: this array has metadata at the start and
may not be suitable as a boot device. If you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
途中で/bootとかには使うなよ?みたいな警告入るけど、気にせずyでも入力しておく。# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb5[0] sdc5[1]
HDDの容量 blocks super 1.2 [2/2] [U_]
[====>................] recovery = 進捗のパーセンテージ% (現在/最大) finish=残り時間(分)min speed=速度K/sec
みたいな感じで出る。# mount /dev/md0 /raid
mount: /dev/md0 is write-protected, mounting read-only
mount: wrong fs type, bad option, bad superblock on /dev/md0,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so.
一瞬焦ったけど、考えてみたらそりゃそうだ。だってまだフォーマットしてないものw# mkfs.ext4 /dev/md0
mke2fs 1.42.12 (29-Aug-2014)
Creating filesystem with 7863552 4k blocks and 1966080 inodes
Filesystem UUID: bf51c5f0-72fa-4245-8c5f-00f2f387924d
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
うむ。うまくいったようだ。#mkdir /raid
# mount /dev/md0 /raid/
# df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 2980844 0 2980844 0% /dev
tmpfs 2990680 876 2989804 1% /dev/shm
tmpfs 2990680 912 2989768 1% /run
tmpfs 2990680 0 2990680 0% /sys/fs/cgroup
/dev/sda3 165369112 114345020 42600772 73% /
tmpfs 2990680 48 2990632 1% /tmp
tmpfs 598136 20 598116 1% /run/user/1000
/dev/md0 30829564 44992 29195480 1% /raid
おっけい。最後のところでちゃんと/raidに入ってる。# tune2fs -l /dev/md0 | grep UUID
Filesystem UUID: bf51c5f0-72fa-4245-8c5f-00f2f387924d
#
# /etc/fstab
# Created by anaconda on Sat Feb 28 19:19:02 2015
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=9da5fbd3-da34-400c-baf9-a517d3b93e56 / ext4 defaults 1 1
UUID=bf51c5f0-72fa-4245-8c5f-00f2f387924d /raid ext4 nofail 0 0
ATTRS{serial}=="シリアルNO" ,ATTR{power/level}="on"
ATTRS{serial}=="シリアルNO" ,ATTR{power/control}="on"
ATTRS{serial}=="シリアルNO" ,ATTR{autosuspend}="-1"
書き込んでみる。効果なし。# sdparm --command=start /dev/sd?
とかをワンクッション入れて、一度スピンアップさせてから操作を行えば良いみたい。