Linux USBメモリの使い方
Table of Contents
デバイスの確認
wurly:~# dmesg [784821.188523] sdb: sdb1 [784821.189096] sd 2:0:0:0: [sdb] Attached SCSI removable disk
fdisk
fdiskを起動
wurly:~# fdisk /dev/sdb The number of cylinders for this disk is set to 14828. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help):
help
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/sdb: 16.0 GB, 16034824192 bytes 88 heads, 24 sectors/track, 14828 cylinders Units = cylinders of 2112 * 512 = 1081344 bytes Disk identifier: 0x7de998f2 Device Boot Start End Blocks Id System /dev/sdb1 4 14829 15654976 c W95 FAT32 (LBA)
パーティションの削除
Command (m for help): d Selected partition 1
再び、パーティションテーブルの表示
Command (m for help): p Disk /dev/sdb: 16.0 GB, 16034824192 bytes 88 heads, 24 sectors/track, 14828 cylinders Units = cylinders of 2112 * 512 = 1081344 bytes Disk identifier: 0x7de998f2 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-14828, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-14828, default 14828): Using default value 14828
ディスクにテーブルを書き込み、終了
Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
フォーマット
mkfs.ext3
wurly:~# mkfs.ext3 /dev/sdb1 mke2fs 1.41.3 (12-Oct-2008) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 979200 inodes, 3914589 blocks 195729 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=4009754624 120 block groups 32768 blocks per group, 32768 fragments per group 8160 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 24 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
ラベル
ラベルの確認方法
wurly:~# e2label /dev/sdb1 usb_backup1
ラベルのつけ方
wurly:~# e2label /dev/sdb1 usb_backup1
マウント方法
ラベルを指定してマウントする
wurly:~# mount LABEL=usb_backup1 /mnt/usb_backup1