Hack 66. mke2fsk を使用してパーティションをフォーマットする
ディスクにパーティションを作成してもまだ使用可能な状態ではありません。
ディスクをフォーマットする必要があります。
この段階では、ディスク情報を見ようとすると、有効なスーパーブロックがないことを示す
次のようなエラーメッセージがでます。
# tune2fs -l /dev/sda1 tune2fs 1.35 (28-Feb-2004) tune2fs: Bad magic number in super-block while trying to open /dev/sda1 Couldn't find valid filesystem superblock.
ディスクをフォーマットするには、以下に示すように mke2fs を使用します。
# mke2fs /dev/sda1
次のようなオプション引数を渡すことができます。
o -m 0 : reserved-blocks-percentage – これは root ユーザに予約された
ファイルシステムブロックのパーセンテージを表示します。
デフォルトは 5% です。次の例ではこれを 0 にセットします。
o -b 4096 : ブロックサイズをバイトで指定します。
有効な値は、1ブロックにつき 1024,2048,4096 です。
# mke2fs -m 0 -b 4096 /dev/sda1 mke2fs 1.35 (28-Feb-2004) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 205344 inodes, 70069497 blocks 0 blocks (0.00%) reserved for the super user First data block=0 Maximum filesystem blocks=71303168 2139 block groups 32768 blocks per group, 32768 fragments per group 96 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872 Writing inode tables: 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.
上記のコマンドは ext2 ファイルシステムを作成します。
ext3 ファイルシステムを作成するには以下のようにします:
# mkfs.ext3 /dev/sda1 # mke2fs –j /dev/sda1