parted を使用してパーティションの種類を正しく設定できません。

parted を使用してパーティションの種類を正しく設定できません。

Centos 6.5でBIOSを更新するには、FreeDosを使用して起動可能なUSBスティックを作成しようとしています。次のガイドラインに従ってください。httobe.com

次のコマンドを使用して空の30MB imgファイルを作成しましたdd

[root@dumbledore freedos_boot]# dd if=/dev/zero of=FreeDos-image.img bs=1M 
count=30
30+0 records in
30+0 records out
31457280 bytes (31 MB) copied, 0.0756911 s, 416 MB/s

上記の記事の著者は、このコマンドは30MBをコピーする必要があると言いましたが、私は31MBを得ました。これは問題ですか?

その後、それを使用してparted作成されたFreeDos-image.imgファイルにパーティションを作成しました。

root@dumbledore freedos_boot]# parted FreeDos-image.img 
GNU Parted 2.1
Using /home/dthacker/freedos_boot/FreeDos-image.img
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit %
(parted) mklabel msdos                                                     
(parted) mkpart primary fat16 0 100%
Warning: The resulting partition is not properly aligned for best performance. 
Ignore/Cancel? C                                                          
(parted) mkpart primary fat32 0 100%
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? I                                                          
(parted) set 1 boot on                                                    
(parted) p                                                                  
Model:  (file)
Disk /home/dthacker/freedos_boot/FreeDos-image.img: 100%
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End   Size  Type     File system  Flags
1      0.00%  100%  100%  primary               boot, lba                                                                                                               

ファイルシステムタイプはFAT16でなければなりませんが、まだ設定されていません。

正しく設定するにはどうすればよいですか?

ベストアンサー1

私はchtaube.euでこのガイドラインの作成者です。 :)

dd はサイズに関して若干一貫性がありません。bs=1Mブロックサイズを1と定義します。テラバイト1024*1024バイトを表します。 30MB は 30*1024*1024 = 31457280 バイトです。dd最終出力は10進メガバイト(1MB = 1000×1000バイト)です。だから31MBが表示されます。したがって、心配することはありません。私は「32MB」と広告しているUSBフラッシュドライブに入ることができるように、保守的に32MBより少し小さいサイズを選択しました。


Arch LinuxとDebianでこの問題を確認し、parted問題を再現できました。

私にとって、これはparted(print)コマンドの出力がp「空の」ファイルシステムを表示するのに対して、パーティションは実際にはFAT16で正しく生成されるため、外観上の問題のように見えます。

fdisk -l FreeDos-image.img以下のTypeScriptで行ったようにこれを確認できます。

ct@darkstar ~/tmp % dd if=/dev/zero of=Freedos.img bs=1M count=30
30+0 records in
30+0 records out
31457280 bytes (31 MB) copied, 0.150141 s, 210 MB/s
ct@darkstar ~/tmp % parted Freedos.img 
WARNING: You are not superuser.  Watch out for permissions.
GNU Parted 3.1
Using /home/ct/tmp/Freedos.img
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit %                                                           
(parted) mklabel msdos                                                    
(parted) mkpart primary fat16 0 100%                                      
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? i                                                          
(parted) set 1 boot on                                                    
(parted) p                                                                
Model:  (file)
Disk /home/ct/tmp/Freedos.img: 100%
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start  End   Size  Type     File system  Flags
 1      0.00%  100%  100%  primary               boot, lba

(parted) q                                                                
ct@darkstar ~/tmp % fdisk -l Freedos.img 

Disk Freedos.img: 30 MiB, 31457280 bytes, 61440 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0007cae1

Device       Boot Start       End Blocks  Id System
Freedos.img1 *        1     61439  30719+  e W95 FAT16 (LBA)

ct@darkstar ~/tmp % 

したがって、あなたには問題はありません。とにかく、これをご指摘いただきありがとうございます。その動作をさらに詳しく調査しparted、それに応じて私のページのマニュアルを更新します。

おすすめ記事