LinuxでのUSBメモリフォーマット
1.マウントポイント・デバイスファイル名の確認
lsblk -f
2.パーティショニング
gdisk /dev/{デバイスファイル名}
USBメモリをパーティショニングする際のHex codeは0700(Microsoft basic data)となる。
Command (? for help): o(新しいGPTパーティションテーブル作成)
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): y
Command (? for help): n(パーティションテーブルに新しいパーティション追加)
Partition number (1-128, default 1): (デフォルト値)
First sector (34-500118158, default = 2048) or {+-}size{KMGTP}: (デフォルト値)
Last sector (2048-500118158, default = 15826910) or {+-}size{KMGTP}: (デフォルト値)
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300): 0700(Microsoft basic dataのHex codeを入力)
Changed type of partition to 'Microsoft basic data'
Command (? for help): w(ディスクにパーティションテーブル書込)
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sdd.
The operation has completed successfully.
3.フォーマット
mkfs.vfat を使う。
コマンドオプション
-v:進捗を表示
-c:不良ブロックの精査を行う
-F: FATサイズを指定。基本32
-n:ボリューム名(ラベル)を指定
mkfs.vfat -v -c -F 32 -n USBDEV /dev/sdd1