blog/content/post/2009/04/25/2009-04-25-00001145.md

9.5 KiB

title author date url wordtwit_post_info categories
Linuxにおけるフォーマット kazu634 2009-04-25 /2009/04/25/_1232/
O:8:"stdClass":13:{s:6:"manual";b:0;s:11:"tweet_times";i:1;s:5:"delay";i:0;s:7:"enabled";i:1;s:10:"separation";s:2:"60";s:7:"version";s:3:"3.7";s:14:"tweet_template";b:0;s:6:"status";i:2;s:6:"result";a:0:{}s:13:"tweet_counter";i:2;s:13:"tweet_log_ids";a:1:{i:0;i:4569;}s:9:"hash_tags";a:0:{}s:8:"accounts";a:1:{i:0;s:7:"kazu634";}}
linux

Linuxでのフォーマットの仕方を忘れがちで何度もGoogleのお世話になっているので、ここでまとめておきます。

パーティションの切り方

fdiskコマンドを用います。

kazu634@srv634% df                                                                /media/disk [951]
Filesystem           1K-ブロック    使用   使用可 使用% マウント位置
/dev/mapper/srv634-root
329233    138796    173439  45% /
tmpfs                   513816             513816   % /lib/init/rw
udev                     10240       100     10140   1% /dev
tmpfs                   513816             513816   % /dev/shm
/dev/sda1               233335     32653    188234  15% /boot
/dev/mapper/srv634-home
142568216    294068 135032012   1% /home
/dev/mapper/srv634-tmp
376807     10307    347044   3% /tmp
/dev/mapper/srv634-usr
4805760   2526672   2034968  56% /usr
/dev/mapper/srv634-var
2882592   1217136   1519024  45% /var
/dev/sdb1               964500     17696    897808   2% /var/backup_data
/dev/sdc1              2010752    265440   1745312  14% /media/disk
kazu634@srv634% fdish /dev/sdc1                                                   /media/disk [952]
zsh: command not found: fdish
kazu634@srv634% sudo fdisk /dev/sdc1                                              /media/disk [953]
[sudo] password for kazu634:
Command (m for help): m
Command action
a   toggle a bootable flag
b   edit bsd disklabel
c   toggle the dos compatibility flag
d   delete a partition
l   list known partition types
m   print this menu
n   add a new partition
o   create a new empty DOS partition table
p   print the partition table
q   quit without saving changes
s   create a new empty Sun disklabel
t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)
Command (m for help): p
Disk /dev/sdc1: 2059 MB, 2059278848 bytes
64 heads, 62 sectors/track, 1013 cylinders
Units = cylinders of 3968 * 512 = 2031616 bytes
Disk identifier: 0x00000000
     Device Boot      Start         End      Blocks   Id  System
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1013, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1013, default 1013): 
Using default value 1013
Command (m for help): p
Disk /dev/sdc1: 2059 MB, 2059278848 bytes
64 heads, 62 sectors/track, 1013 cylinders
Units = cylinders of 3968 * 512 = 2031616 bytes
Disk identifier: 0x00000000
     Device Boot      Start         End      Blocks   Id  System
/dev/sdc1p1               1        1013     2009761   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 22: 無効な引数です.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

フォーマットの仕方

mkfsコマンドを用います。

kazu634@srv634% sudo mkfs -t ext3 /dev/sdc1                                            /media [959]
[sudo] password for kazu634:
mke2fs 1.41.3 (12-Oct-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
125696 inodes, 502753 blocks
25137 blocks (5.00%) reserved for the super user
First data block=
Maximum filesystem blocks=515899392
16 block groups
32768 blocks per group, 32768 fragments per group
7856 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.