Linuxのファイルシステムを詳解します

FrontPage


パーティション(partition)の諸元

参照元→linux-2.6.12.2/Documentation/devices.txt
基本領域(Primary Partition)4つ
拡張領域(Extended Partition)+論理領域(Logical Partition)2G-1
Floppy disks8個
hard disk/CD-ROM interface64個
SCSI disk devices15個

パーティションを切る

fdiskパーティションテーブル操作ツール
partedGNU Parted パーティションテーブル操作ツール

実践編 2Tディスク作成(400G×5個)

ext2、xfs等は、パーティションタイプ 83 Linuxでも作成可能です。
ここは LVM を利用して 5個のディスクをストライプし、2Tディスクを作成します。
fdisk5回
パーティションに切るとき Type は 8e (Linux LVM) にする~
fdisk /dev/sd{b,c,d,e,f} ← これはできないけど。。5回fdisk
n
1
(Enter)
(Enter)
t
8e
w
PV作成
pvcreate /dev/sd{b,c,d,e,f}1
Physical volume "/dev/sdb1" successfully created
Physical volume "/dev/sdc1" successfully created
Physical volume "/dev/sdd1" successfully created
Physical volume "/dev/sde1" successfully created
Physical volume "/dev/sdf1" successfully created
VG作成
LVは最大65536個のまでのPEで作成できるので、~
最大の2TBまで使えるためには~
  • s オプションでPEサイズを32MB以上にする必要あり~
vgcreate -s 32m /dev/vg0 /dev/sd{b,c,d,e,f}1
Volume group "vg0" successfully created
LV作成
  • i でストライピング台数を指定します
lvcreate -i 5 -L 1850g -n vgtest /dev/vg0
Using default stripesize 64KB
Logical volume "vgtest" created
※2Tは作れませんでした(´・ω・`)ショボーン
lvcreate -i 5 -L 2000g -n vgtest /dev/vg0
Using default stripesize 64KB
Insufficient free extents (59615) in volume group vg0: 64000 required
mkfs、mount、umount
mkfs -t ext2 /dev/vg0/vgtest
mount -t ext2 /dev/vg0/vgtest /mnt/vgtest
df -h
/dev/mapper/vg0-vgtest 1.8T 77M 1.7T 1% /mnt/vgtest
umount /mnt/vgtest
LV削除
lvremove /dev/vg0/vgtest
VG削除
vgchange -a n /dev/vg0
vgremove /dev/vg0

実践編 6Tディスク作成(500G×13個)

sx8モジュールが読み込まれ、/dev/sx8/0, /dev/sx8/1とかに~
なってしまいました。~
brw------- 1 root root 160, 0 Jan 27 2006 0
brw------- 1 root root 160, 32 Jan 27 2006 1
brw------- 1 root root 160, 64 Jan 27 2006 2
brw------- 1 root root 160, 96 Jan 27 2006 3
brw------- 1 root root 160, 128 Jan 27 2006 4
brw------- 1 root root 160, 160 Jan 27 2006 5
brw------- 1 root root 160, 192 Jan 27 2006 6
brw------- 1 root root 160, 224 Jan 27 2006 7
brw------- 1 root root 161, 0 Jan 27 2006 8
brw------- 1 root root 161, 32 Jan 27 2006 9
brw------- 1 root root 161, 64 Jan 27 2006 10
brw------- 1 root root 161, 96 Jan 27 2006 11
brw------- 1 root root 161, 128 Jan 27 2006 12

~
各ディスクは /dev/sx8/0, /dev/sx8/1 のように割り当てて~
ありまして、LVMで1つの大きいファイルシステムにしようと~
しましたが、~
~
/dev/sx8*のメジャーデバイス番号(160)は pvcreate(LVM) ~
コマンドでPV作成ができないことがわかりました。~
(ソースを読みました)~
~
そこでっ~
/dev/sx8/*をMD化
raid0で/dev/md*に変換します。~
MDは4T越えができないため。以下のようにmd作成を行いました。~

for *1 do mdadm -C /dev/md$x --force --level=raid0 --raid-devices=1 /dev/sx8/$x'p1' ; done
for *2 do pvcreate /dev/md$x; done
vgcreate -s 32m /dev/vg0 /dev/md{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14}
lvcreate -i 15 -l 223560 -n lvtest /dev/vg0
mkfs -t xfs /dev/vg0/lvtest
mount -t xfs /dev/vg0/lvtest /mnt/xfs
df -Th
Filesystem      Size Used Avail Use% Mounted on
/dev/mapper/vg0-lvtest
       xfs 6.9T 528K 6.9T 1% /mnt/xfs
umount /mnt/xfs
lvremove /dev/vg0/lvtest
vgchange -a n /dev/vg0
vgremove /dev/vg0
for *3 do mdadm -r /dev/md$x; done
for *4 do mdadm -S /dev/md$x; done
mdadm --zero-superblock /dev/sx8/*p1

※メモ
500Gx15個~
vgdisplay
--- Volume group ---
VG Name vg0
System ID
Format lvm2
Metadata Areas 15
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 15
Act PV 15
VG Size 6.82 TB
PE Size 32.00 MB
Total PE 223560
Alloc PE / Size 0 / 0
Free PE / Size 223560 / 6.82 TB
VG UUID 3YZ3Fr-8eke-IefK-zRpM-6H3O-Jaq4-NBtuBh

lvcreate -i 15 -l 223560 -n lvtest /dev/vg0
Using default stripesize 64KB
Logical volume "lvtest" created
vgdisplay
--- Volume group ---
VG Name vg0
System ID
Format lvm2
Metadata Areas 15
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 15
Act PV 15
VG Size 6.82 TB
PE Size 32.00 MB
Total PE 223560
Alloc PE / Size 223560 / 6.82 TB
Free PE / Size 0 / 0
VG UUID 3YZ3Fr-8eke-IefK-zRpM-6H3O-Jaq4-NBtuBh

コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

関連ソフト/文書

Firefox3 Meter  Use OpenOffice.org

管理人/副管理人のみ編集できます