Palm84 某所の日記

死のうは一定、しのびクマには何しよぞ...

USBメモリのパーティションをイジるんJaa!の巻

2013.9.8 「SDフォーマッター」について追記しますた。

最近はそうでもないような気がしないでもないようなあるような今日この頃ですが、USBメモリでブートできない際に、パーティションを切りなおすとおk!なことがあったのでござる。

まぁ at your own risk なだめ元手段ですわな!

USBメモリを窓から(ry)する前に試してみてはいかがかと。

なれど、詳しい仕様とか以前の話とか、USBメモリとSDカードの違いとかは無知ゆえ戯言レベルかもしれませぬ。ご承知おきくだされますよう。

INDEX

パーティション形式いろいろ

現時点でUSBメモリの場合だとおおまかにだいたいこんなかんじでせうか。

  • USB-HDD mode - HD形式
    1. Align to sectors - 1MiB アライメント,、または、8の倍数セクタ区切り(Vista以降の標準的設定)
    2. Align to cylinder - (CHSの)ヘッド数255・セクタ数63、offset セクタ63(以前の標準的設定)
    3. CHS形式(?) - シリンダ数 1024 以下(8.4GiB 8.4GB(7.84 7.875GiB)以下の古い規格向け?)
  • USB-ZIP mode - ZIP形式(パーティション番号4のみ使用)
  • USB FDD - FD形式(MBRなし = パーティションなし)

最近のUSBメモリやSDカードなどは購入時の offset (第1パーティションの開始位置)が 4MiB(セクタ8192)とか、56KiB(セクタ112)とかHD形式1に近いかんじになってござったです。昔のは知りませんが...

近頃のBIOSでは Emulation 形式を選択できたりするのでどれでも問題ない場合が多いみたいでありす。

古いPCの話でありますが、USB ZIP 形式じゃないとNGなモノがあったり、2002,2003年購入 の USB LS120 とか USB RMD-FDD で認識されるヤツでは HD形式3かFD形式(FAT16のみ)でしかブートできひんかったり、とかありましたです。

【2013.9.8 追記】SDフォーマッター4.0

よく理解できてないのですが、SDカードの場合は offset 8192 が最適なんだそうで。USBキーとの違いをわかってませんが、SDカードではこっちの方が確実なのかも... です。

FAT16でしかブートできないと思ってた古いPC(USB RMD-FDD で認識)でこれを試した所、FAT32でもブート出来るようになりました。

※ SDフォーマッター使用時の詳細について後に追記しときました。

【追記】 バックアップ - DDforWindows

書くつもりが忘れてました。すみません。。。

SDカードなどパーティションの変更によりデジカメや携帯などで使えなくなることがあるかもです。また、方法によっては状況悪化してしまう場合もあるかと。

念のため、元に戻せるようにバックアップイメージの作成をおすすめしときます。

下記ツールがお手軽かと(※ 「管理者として実行」しないとダメみたいです)

※ 容量そのままサイズのイメージができるので空き容量にはご注意ですお。

Windows の diskpart コマンド (HD形式1)

上記HD形式1となりました。16GB, 8GB でほぼ同じ形式、4GBでは offset が小さめ。

Windows 8 の回復ドライブもこれでした。

私見ですが...

  • NTFS + SYSLINUX とかは確実かも?

やり方は下記ページが参考になるかと。

16GB USBメモリー
  • offset - 0x800 = 2048 = 1024KiB
  • 255 heads, 63 sectors/track, 1954 cylinders
  • offset とセクタ数(の区切り) - 不一致
  • パーティションテーブル
ADDRESS   00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
---------------------------------------------------------
000001B0                                            80 20
000001C0  21 00 07 FE FF FF 00 08 00 00 00 28 DF 01 00 00
000001D0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001E0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001F0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 AA
  • fdisk -lu
Disk /dev/sdb: 16.1 GB, 16079781888 bytes
255 heads, 63 sectors/track, 1954 cylinders, total 31405824 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
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048    31404031    15700992    7  HPFS/NTFS
8GB microSDHC

16GBと同様

  • offset - 0x800 = 2048 = 1024KiB
  • 255 heads, 63 sectors/track, 966 cylinders
  • offset とセクタ数 - 不一致
  • パーティションテーブル
ADDRESS   00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
---------------------------------------------------------
000001B0                                            80 20
000001C0  21 00 0B FE FF C5 00 08 00 00 00 D8 EC 00 00 00
000001D0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001E0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001F0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 AA
  • fdisk -lu
Disk /dev/sdb: 7948 MB, 7948206080 bytes
255 heads, 63 sectors/track, 966 cylinders, total 15523840 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
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048    15523839     7760896    b  W95 FAT32
Partition 1 has different physical/logical endings:
     phys=(965, 254, 63) logical=(966, 80, 10)
4GB microSDHC

16GB, 8GB より offset 小さい。

  • offset = 0x80 = 128 = 64KiB
  • 255 heads, 63 sectors/track, 482 cylinders
  • offset とセクタ数 - 不一致
  • パーティションテーブル
ADDRESS   00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
---------------------------------------------------------
000001B0                                            80 02
000001C0  03 00 0B FE 7F E1 80 00 00 00 80 2F 76 00 00 00
000001D0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001E0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001F0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 AA
  • fdisk -lu
Disk /dev/sdb: 3965 MB, 3965714432 bytes
255 heads, 63 sectors/track, 482 cylinders, total 7745536 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
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *         128     7745535     3872704    b  W95 FAT32
Partition 1 has different physical/logical endings:
     phys=(481, 254, 63) logical=(482, 35, 1)

Linux の fdisk コマンド

【追記】

最近のではディストリやバージョンにより違いがあります。

fdisk コマンドをオプション無指定で実行しますた。

8GB以下では、上記HD形式3となりました。16GBではちょっと変な値かも...

私見ですが...

  • 8GB以下で古い規格にも対応させたい場合は試す価値あるかも?
  • 16GB以上ではいまいちのような...
16GB USBメモリー
【追記】

※ 最近の fdisk でこの設定にするにはオプションが必要になるかも?下記は一例。

# fdisk -u=cylinders -c=dos /dev/sdx

これは USB-ZIP 形式に近いみたい?SSD向けの設定になってるのかも。

CHSは64/32、offset 32 設定となりました。いまいちなかんじ?(fdisk -H 255 -S 63 とか指定して実行する手もあるけど)

  • offset - 0x20 = 32 = 16KiB
  • 64 heads, 32 sectors/track, 15334 cylinders
  • offset とセクタ数 - 一致
  • パーティションテーブル
ADDRESS   00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
---------------------------------------------------------
000001B0                                            80 01
000001C0  01 00 0C 3F E0 FF 20 00 00 00 E0 36 DF 01 00 00
000001D0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001E0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001F0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 AA
  • fdisk -lu
Disk /dev/sdb: 16.1 GB, 16079781888 bytes
64 heads, 32 sectors/track, 15334 cylinders, total 31405824 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
Disk identifier: 0x973a4d66

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *          32    31405823    15702896    c  W95 FAT32 (LBA)
8GB microSDHC
【追記】

※ 最近の fdisk でこの設定にするにはオプションが必要になるかも?下記は一例。

# fdisk -u=cylinders -c=dos /dev/sdx

いわゆるCHS形式となるようです。シリンダ数が1024以下で1024に近い値となりますがセクタ数は中途半端設定に。

2002,2003年購入の USB LS120, USB RMD-FDD 認識のヤツでは、この設定 + 2GB以下 + FAT16 でしかブートしませんでした。

  • offset - 0x3E = 62 = 31KiB
  • 245 heads, 62 sectors/track, 1021 cylinders
  • offset とセクタ数 - 一致
  • パーティションテーブル
ADDRESS   00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
---------------------------------------------------------
000001B0                                            80 01
000001C0  01 00 0B F4 FE FC 3E 00 00 00 C0 A5 EC 00 00 00
000001D0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001E0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001F0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 AA
  • fdisk -lu
Disk /dev/sdb: 7948 MB, 7948206080 bytes
245 heads, 62 sectors/track, 1021 cylinders, total 15523840 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
Disk identifier: 0x50ddf1ee

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *          62    15508989     7754464    b  W95 FAT32

USB-HDD mode - Align to cylinder(HD形式2)

BOOTICE v1.0.4 にて設定しました。

容量に関係なくHD形式2となる模様。

私見ですが...

  • 無難なHD形式かな?
16GB USBメモリー
  • offset - 0x3F = 63 = 31.5KiB
  • 255 heads, 63 sectors/track, 1954 cylinders
  • offset とセクタ数 - 一致
  • パーティションテーブル
ADDRESS   00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
---------------------------------------------------------
000001B0                                            80 FE
000001C0  FF FF 0C FE FF FF 3F 00 00 00 C0 36 DF 01 00 00
000001D0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001E0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001F0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 AA
  • fdisk -lu
Disk /dev/sdb: 16.1 GB, 16079781888 bytes
255 heads, 63 sectors/track, 1954 cylinders, total 31405824 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
Disk identifier: 0x00004d66

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *          63    31405822    15702880    c  W95 FAT32 (LBA)
8GB microSDHC
  • offset - 0x3F = 63 = 31.5KiB
  • 255 heads, 63 sectors/track, 966 cylinders
  • offset とセクタ数 - 一致
  • パーティションテーブル
ADDRESS   00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
---------------------------------------------------------
000001B0                                            80 FE
000001C0  FF FF 0B FE FF FF 3F 00 00 00 C0 DF EC 00 00 00
000001D0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001E0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001F0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 AA
  • fdisk -lu
Disk /dev/sdb: 7948 MB, 7948206080 bytes
255 heads, 63 sectors/track, 966 cylinders, total 15523840 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
Disk identifier: 0x00002efe

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *          63    15523838     7761888    b  W95 FAT32
Partition 1 has different physical/logical beginnings (non-Linux?):
     phys=(1023, 254, 63) logical=(0, 1, 1)
Partition 1 has different physical/logical endings:
     phys=(1023, 254, 63) logical=(966, 80, 9)

USB-HDD mode - Align to sectors(HD形式1)

BOOTICE v1.0.4 にて設定しました。HD形式1となり申した。

16GB, 8GB, 4GB とも同様の設定になりました。16GB, 8GB の状態は diskpart と同じです。

16GB USBメモリー
  • offset - 0x800 = 2048 = 1024KiB
  • 255 heads, 63 sectors/track, 1954 cylinders
  • offset とセクタ数 - 不一致
  • パーティションテーブル
ADDRESS   00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
---------------------------------------------------------
000001B0                                            80 FE
000001C0  FF FF 0C FE FF FF 00 08 00 00 FF 2E DF 01 00 00
000001D0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001E0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001F0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 AA
  • fdisk -lu
Disk /dev/sdb: 16.1 GB, 16079781888 bytes
255 heads, 63 sectors/track, 1954 cylinders, total 31405824 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
Disk identifier: 0x00004d66

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048    31405822    15701887+   c  W95 FAT32 (LBA)
8GB microSDHC
  • offset - 0x800 = 2048 = 1024KiB
  • 255 heads, 63 sectors/track, 966 cylinders
  • offset とセクタ数 - 不一致
  • パーティションテーブル
ADDRESS   00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
---------------------------------------------------------
000001B0                                            80 FE
000001C0  FF FF 0B FE FF FF 00 08 00 00 FF D7 EC 00 00 00
000001D0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001E0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001F0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 AA
  • fdisk -lu
Disk /dev/sdb: 7948 MB, 7948206080 bytes
255 heads, 63 sectors/track, 966 cylinders, total 15523840 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
Disk identifier: 0x00002efe

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048    15523838     7760895+   b  W95 FAT32
Partition 1 has different physical/logical beginnings (non-Linux?):
     phys=(1023, 254, 63) logical=(0, 32, 33)
Partition 1 has different physical/logical endings:
     phys=(1023, 254, 63) logical=(966, 80, 9)

USB-ZIP mode

BOOTICE v1.0.4 にて設定しました。ZIP形式となり申し候。

実際に触ったことはござらぬが USB-ZIP 固定対応PCの場合はこの設定が必要なようでおま。

ヘッド数64・セクタ数32にすべきとの資料がありますが、BOOTICE ではそうならぬ様ナリ。

これでうまくいかない場合は、Linux で fdisk -H 64 -S 32 試すとか。

16GB USBメモリー
  • offset - 0x20 = 32 = 16KiB
  • 255 heads, 63 sectors/track, 1954 cylinders
  • offset とセクタ数 - 不一致
  • パーティションテーブル
ADDRESS   00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
---------------------------------------------------------
000001B0                                            00 00
000001C0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001D0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001E0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 FE
000001F0  FF FF 0C FE FF FF 20 00 00 00 E0 36 DF 01 55 AA
  • fdisk -lu
Disk /dev/sdb: 16.1 GB, 16079781888 bytes
255 heads, 63 sectors/track, 1954 cylinders, total 31405824 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
Disk identifier: 0x00004d66

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb4   *          32    31405823    15702896    c  W95 FAT32 (LBA)
8GB microSDHC
  • offset - 0x20 = 32 = 16KiB
  • 255 heads, 63 sectors/track, 966 cylinders
  • offset とセクタ数 - 不一致
  • パーティションテーブル
ADDRESS   00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
---------------------------------------------------------
000001B0                                            00 00
000001C0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001D0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000001E0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 FE
000001F0  FF FF 0B FE FF FF 20 00 00 00 E0 DF EC 00 55 AA
  • fdisk -lu
Disk /dev/sdb: 7948 MB, 7948206080 bytes
255 heads, 63 sectors/track, 966 cylinders, total 15523840 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
Disk identifier: 0x00002efe

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb4   *          32    15523839     7761904    b  W95 FAT32
Partition 4 has different physical/logical beginnings (non-Linux?):
     phys=(1023, 254, 63) logical=(0, 0, 33)
Partition 4 has different physical/logical endings:
     phys=(1023, 254, 63) logical=(966, 80, 10)

【2013.9.8 追記】SDフォーマッター

SDフォーマッター4.0 + microSDHC 8GB で確認しました。

ブートには不向きなのではと誤解してましたが(滝汗)、CHS形式 + FAT16でしかブートできなかった古いPC(USB RMD-FDD で認識)でこれを使ったら FAT32 でもブートしました。

  • offset - 0x2000 = 8192 = 4096KiB (4MiB)
  • 81 heads, 10 sectors/track, 19165 cylinders
  • offset とセクタ数 - 不一致
  • パーティションテーブル
ADDRESS   00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F
----------------------------------------------------------
000001B0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 80 82
000001C0  03 00 0B 50 CA C6 00 20  00 00 00 C0 EC 00 00 00
000001D0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
000001E0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
000001F0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 AA
  • fdisk -lu
Disk /dev/sdb: 7948 MB, 7948206080 bytes
81 heads, 10 sectors/track, 19165 cylinders, total 15523840 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
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        8192    15523839     7757824    b  W95 FAT32

BOOTICE

※ 取扱いは慎重に。くれぐれも disk の指定のお間違いなき様に

v1.0.4 2013.03.03 での確認です。

disk の指定を確認!間違えるとドボン!

f:id:palm84:20181223131112p:plain

【Sector Edit】でパーティションテーブルなどの確認やコピーができます。

f:id:palm84:20181223131115p:plain

【Parts Manage】を押すとパーティション画面が出ます。

f:id:palm84:20181223131119p:plain

パーティション切り直しは【ReFormat USB Disk】から

f:id:palm84:20181223131124p:plain

「 USB-HDD mode (Multi-Partitions)」を選択すると align の選択ができます。

f:id:palm84:20181223131128p:plain

いろいろ

USBメモリ用のパーティション・エディタとしては BOOTICE より下記の方がメジャーかも。

ほなですねん。