サイズ変更
partedを起動して表示単位をセクタに変更し、現在のパーティション状態を表示。
% parted /dev/sdb GNU Parted 3.2 Using /dev/sdb Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) unit s (parted) print Model: USB 2.0 Flash Disk (scsi) Disk /dev/sdb: 3948543s Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 2048s 3948542s 3946495s primary ext2 boot
parted 3.0 以降は resize コマンドが削除されているので、resizepart コマンドを使う。データが破壊される恐れのある場合は以下のようにその旨表示される。今回は少しだけパーティションサイズを切り詰める。
(parted) resize 1 Error: The resize command has been removed in parted 3.0 (parted) resizepart 1 End? [3948542s]? 3000000s Warning: Shrinking a partition can cause data loss, are you sure you want to continue? Yes/No? No (parted) resizepart 1 End? [3000000s]? 3800000s (parted) print Model: USB 2.0 Flash Disk (scsi) Disk /dev/sdb: 3948543s Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 2048s 3800000s 3797953s primary ext2 boot
パーティション作成
作成は mkpart で。開始と終了セクタは無謀なものを入力しても適当な値に変更してくれる。
(parted) mkpart Partition type? primary/extended? p File system type? [ext2]? fat32 Start? 3800000s End? -1s Warning: You requested a partition from 3800000s to 3948542s (sectors 3800000..3948542). The closest location we can manage is 3800001s to 3948542s (sectors 3800001..3948542). Is this still acceptable to you? Yes/No? Yes Warning: The resulting partition is not properly aligned for best performance. Ignore/Cancel? Ignore (parted) p Model: USB 2.0 Flash Disk (scsi) Disk /dev/sdb: 3948543s Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 2048s 3800000s 3797953s primary ext2 boot 2 3800001s 3948542s 148542s primary fat32 lba (parted) align-check optimal 1 1 aligned (parted) p Model: USB 2.0 Flash Disk (scsi) Disk /dev/sdb: 3948543s Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 2048s 3800000s 3797953s primary ext2 boot 2 3800001s 3948542s 148542s primary fat32 lba
パーティション移動
move コマンドなくなったんだね。