UDFのブロックデバイス(ハードドライブまたはフラッシュドライブ)をフォーマットするバッシュスクリプト。出力は、複数のオペレーティングシステムファミリで読み取り/書き込みに使用できるドライブです:Windows、MacOS、Linux。このスクリプトは、MacOSまたはLinuxで実行できる必要があります。
Advancedユーザーの場合、Format-UUDFは、パーティションテーブルを変更せずに、単一の既存のパーティションをフォーマットすることもできます。この方法を使用すると、新しくフォーマットされたUDFパーティションがMacOSで使用できないようにすることに注意してください(ただし、LinuxとWindowsで使用可能です)。 (警告については#24を参照してください。)この制限のため、推奨事項はデバイス全体をフォーマットすることです。
Format-UUDFは、素朴にフォーマットされたUDFデバイスがさまざまなオペレーティングシステムで動作するのを妨げるOS固有の癖に対処するために作成されました。複雑な要因のいくつかを以下に示します。
一見すると、これらの制約は部分的な競合にあるように見えます。 Pieterが示唆しているように、ソリューションは、ドライブの最初のブロックに偽のパーティションテーブル(MBR経由)を配置することです。これは、UDF(おそらく意図的に)最初のブロックを利用しないために機能します。残念ながら、他のすべての変数(デバイスの論理ブロックサイズなど)をジャグリングしながら、これを行う簡単な方法はありませんでした。 Format-UUDFは、Windowsに互換性が追加されるために、このような偽のMBRを書き込みます。これがあなたが望むものではない場合、 -p noneでMBRを無効にすることができます。
このプロジェクトの目標は、最新の機能を備えたクロスプラットフォームファイルシステムへのアクセスを提供することです。
すべてのオペレーティングシステムがUDFをサポートするわけではありません。次の表は、UDFのオペレーティングシステムのサポートの詳細です。データはhttps://en.wikipedia.org/wiki/universal_disk_format#compatibilityから採用されました(2017-06-16に取得されたとおり)。
以下に特にリストされていない限り、両方の読み取り/書き込みはサポートされています。
| オペレーティング·システム | 読み取り専用 | 注記 |
|---|---|---|
| Windows XP、サーバー2003 | 読み取り専用 | サードパーティのユーティリティで利用可能なサポートを書き込みます |
| Windows Vista、7、8、10 | Microsoftが「ライブファイルシステム」と呼んでいます。偽のフルディスクパーティションが必要です | |
| Mac OS 9 | ||
| Mac OS X 10.5から10.11 | ||
| macOS 10.12+ | ||
| Linux 2.6+、3.x | UDFリビジョン2.01以前は読み書き/書き込みがあります。 UDFリビジョン2.01の後、読み取り専用です。 | |
| AIX 5.2、5.3、6.1 | ||
| Beos、Magnussoft Zeta、Haiku | ||
| dosbox | ||
| ecomstation、OS/2 | OS/2の追加料金ドライバー | |
| NetBSD 5.0 | ||
| Solaris 8、9、10 |
| オペレーティング·システム | 注記 |
|---|---|
| Windows 95 OSR2+、98 | ユーティリティには、DLAとIncdが含まれます |
| Windows 2000、私 |
| オペレーティング·システム | 注記 |
|---|---|
| Dos、Freedos、Windows 3.11以上 | ISO9660後方互換構造を持つファイルシステムを読むことができます |
すべてのオペレーティングシステムが4Kドライブ(高度な形式)をサポートするわけではありません。オペレーティングシステムがUDFをサポートしているが、4Kドライブではなくサポートしている場合でも、Format-udfを使用して問題に遭遇する可能性があります。
次の表には、4KドライブのWindowsサポートの詳細があります。データは、Windowsの4KセクターハードドライブのMicrosoftサポートポリシーから採用されました(2017-06-16に取得されました)。このテーブルにオーバーレイされているのは、Format-UUDFコミュニティの結果をテストしています。 (XPでテストしてくれた@Paliに感謝します。)
| サイズ / OS | 512バイトネイティブ | 512エミュレーション (別名「512e」) | 4Kネイティブ (別名「4kn」) |
|---|---|---|---|
| 論理ブロックサイズ | 512バイト | 512バイト | 4096バイト |
| 物理ブロックサイズ | 512バイト | 4096バイト | 4096バイト |
| 最大UDFファイル システム容量 | 2 TIB | 2 TIB | 16 TIB |
| Windows XP | サポート; 作品 | サポートされていない; うまくいきません | サポートされていない; うまくいきません |
| Windows XP Pro X64、 サーバー2003、 サーバー2003 R2 | サポート; おそらく機能しますが、テストされていません | サポートされていません | サポートされていません |
| WindowsVista、 サーバー2008 | サポート; おそらく機能しますが、テストされていません | サポート; おそらく機能しますが、テストされていません | サポートされていません |
| Windows7、 サーバー2008 R2 | サポート; おそらく機能しますが、テストされていません | サポート; おそらく機能しますが、テストされていません | サポートされていません |
| Windows8、 サーバー2012 | サポート; おそらく機能しますが、テストされていません | サポート; おそらく機能しますが、テストされていません | サポート; おそらく機能しますが、テストされていません |
| Windows8.1、 サーバー2012 R2 | サポート; おそらく機能しますが、テストされていません | サポートされていません | サポートされていません |
| Windows10、 サーバー2016 | サポート; おそらく機能しますが、テストされていません | サポートされていません | サポート; おそらく機能しますが、テストされていません |
テストを実施し、Format-UUDFの将来のユーザーに利益をもたらすためにこのテーブルを更新したい場合は、プルリクエストを送信してください。生データまたはテスト結果へのリンクを含めてください。
printfxxdblockdev 、 ioregblockdev 、 diskutillsblk 、 diskutilumount 、 diskutilmkudffs 、 newfs_udfUbuntuに必要な前提条件をインストールするには:
sudo apt-get install udftools coreutils vim-common
Format-udfは、自己完結型のスクリプトです。フォーマットudf.shを選択したディレクトリにコピーするだけです。実行可能にすることを忘れないでください:
chmod +x format-udf.sh
Bash script to format a block device (hard drive or Flash drive) in UDF.
The output is a drive that can be used for reading/writing across multiple
operating system families: Windows, macOS, and Linux.
This script should be capable of running in macOS or in Linux.
Usage: ./format-udf.sh [-b BLOCK_SIZE] [-f] [-p PARTITION_TYPE] [-w WIPE_METHOD] device label
./format-udf.sh -v
./format-udf.sh -h
-b BLOCK_SIZE
Block size to be used during format operation.
If absent, defaults to value reported by blockdev/diskutil.
This is an expert-only option. Please consult the README for details.
-f
Forces non-interactive mode. Useful for scripting.
Please use with caution, as no user confirmation is given.
-h
Display help information and exit.
-p PARTITION_TYPE
Partition type to set during format operation.
Currently supported types include: mbr, none
mbr - Master boot record (default)
none - Do not modify partitions
If absent, defaults to 'mbr'.
See also:
https://github.com/JElchison/format-udf#why
-v
Display version information and exit.
-w WIPE_METHOD
Wipe method to be used before format operation.
Currently supported types include: quick, zero, scrub
quick - Quick method (default)
zero - Write zeros to the entire device
scrub - Iteratively writes patterns on device
to make retrieving the data more difficult.
Requires 'scrub' to be executable and in the PATH.
See also http://linux.die.net/man/1/scrub
If absent, defaults to 'quick'.
Note: 'zero' and 'scrub' methods will take a long time.
device
Device to format. Examples:
* /dev/sdx (Linux, where 'x' is a letter) or
* /dev/diskN (macOS, where 'N' is a number)
label
Label to apply to formatted device.
Example: ./format-udf.sh /dev/sdg "My UDF External Drive"
ubuntuで:
user@computer:~$ ./format-udf.sh /dev/sdg "My UDF External Drive"
[+] Validating arguments...
[+] Testing dependencies...
[+] Looking for drive detail tool... using /sbin/blockdev
[+] Looking for drive listing tool... using /sbin/blockdev
[+] Looking for drive info tool... using /bin/lsblk
[+] Looking for drive summary tool... using /sbin/blkid
[+] Looking for unmount tool... using /bin/umount
[+] Looking for UDF tool... using /usr/sbin/mkudffs
[+] Detecting logical block size...
[sudo] password for user:
[*] Detected logical block size of 512
[+] Validating detected logical block size...
[+] Detecting physical block size...
[*] Detected physical block size of 512
[+] Validating detected physical block size...
[+] Validating file system block size...
[*] Using file system block size of 512
[+] Detecting total size...
[*] Detected total size of 8019509248
[+] Validating detected total size...
[+] Gathering drive information...
/dev/sdg: LABEL="Old Drive" UUID="4843-D1BD" TYPE="vfat"
RO RA SSZ BSZ StartSec Size Device
rw 256 512 512 0 8019509248 /dev/sdg
The above-listed device (and partitions, if any) will be completely erased.
Type 'yes' if this is what you intend: yes
[+] Unmounting device...
umount: /dev/sdg: not mounted
[+] Zeroing out first chunk of device...
4096+0 records in
4096+0 records out
2097152 bytes (2.1 MB, 2.0 MiB) copied, 0.450716 s, 4.7 MB/s
[+] Formatting /dev/sdg ...
filename=/dev/sdg
label=My UDF External Drive
uuid=5e4924cc17b50769
blocksize=512
blocks=15663104
udfrev=2.01
start=0, blocks=64, type=ERASE
start=64, blocks=13, type=VRS
start=77, blocks=19, type=ERASE
start=96, blocks=16, type=MVDS
start=112, blocks=16, type=ERASE
start=128, blocks=16, type=LVID
start=144, blocks=112, type=ERASE
start=256, blocks=1, type=ANCHOR
start=257, blocks=15662590, type=PSPACE
start=15662847, blocks=1, type=ANCHOR
start=15662848, blocks=96, type=ERASE
start=15662944, blocks=16, type=RVDS
start=15662960, blocks=143, type=ERASE
start=15663103, blocks=1, type=ANCHOR
[+] Writing fake MBR...
16+0 records in
16+0 records out
16 bytes copied, 0.0037039 s, 4.3 kB/s
2+0 records in
2+0 records out
2 bytes copied, 3.7193e-05 s, 53.8 kB/s
[+] Successfully formatted /dev/sdg: UUID="5e4924cc17b50769" LABEL="My UDF External Drive" TYPE="udf" PTTYPE="dos"
Please disconnect/reconnect your drive now.
MacOSについて:
computer:~ user$ ./format-udf.sh /dev/disk4 "My UDF External Drive"
[+] Validating arguments...
[+] Testing dependencies...
[+] Looking for drive detail tool... using /usr/sbin/ioreg
[+] Looking for drive listing tool... using /usr/sbin/diskutil
[+] Looking for drive info tool... using /usr/sbin/diskutil
[+] Looking for drive summary tool... using (none)
[+] Looking for unmount tool... using /usr/sbin/diskutil
[+] Looking for UDF tool... using /sbin/newfs_udf
[+] Detecting logical block size...
[*] Detected logical block size of 512
[+] Validating detected logical block size...
[+] Detecting physical block size...
[+] Validating file system block size...
[*] Using file system block size of 512
[+] Detecting total size...
[*] Detected total size of 8019509248
[+] Validating detected total size...
[+] Gathering drive information...
/dev/disk4 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *8.0 GB disk4
1: Windows_FAT_32 Old Drive 8.0 GB disk4s1
The above-listed device (and partitions, if any) will be completely erased.
Type 'yes' if this is what you intend: yes
[+] Unmounting device...
Password:
Unmount of all volumes on disk4 was successful
[+] Zeroing out first chunk of device...
4096+0 records in
4096+0 records out
2097152 bytes transferred in 3.113956 secs (673469 bytes/sec)
[+] Formatting /dev/disk4 ...
write to block device: /dev/disk4 last written block address: 15663103
[+] Writing fake MBR...
16+0 records in
16+0 records out
16 bytes transferred in 0.000615 secs (26021 bytes/sec)
2+0 records in
2+0 records out
2 bytes transferred in 0.000644 secs (3106 bytes/sec)
[+] Successfully formatted
Please disconnect/reconnect your drive now.
ドライブをフォーマットするときに、Format-udfが正しいブロックサイズを使用することが非常に重要な場合。 Format-UUDFは、正しい(論理)ブロックサイズを検出して使用しようとします。自分が何をしているのかがわかっている場合は、Format -UUDF -b BLOCK_SIZEオプションを使用して、検出されたブロックサイズ値を明示的にオーバーライドできます。
フォーマット中に間違ったブロックサイズを使用している場合(つまり、ドライブの論理ブロックサイズと一致しないもの)、結果のドライブにはOS互換性の問題があり、最適ではないパフォーマンスの問題に苦しむ可能性があります。
同様に、結果のドライブを正しいブロックサイズを使用して取り付けることが重要です。多くのオペレーティングシステムは、1つのブロックサイズのみを試みます(通常、マウントユーティリティがデフォルトであれ)。たとえば、UDFデバイスをマウントするには、WindowsがUDFファイルシステムが論理ブロックサイズに等しいブロックサイズを使用する必要があるようです。ブロックサイズがOSのデフォルトでない場合、自動マウントはOSで動作しない可能性があります。わずかな迷惑ですが、標準以外のブロックサイズでは手動の取り付け試行がまだ成功するはずです。
Linuxに手動でマウントする方法の例:
$ mount -t udf -o bs=4096 /dev/sdX /mnt/mount-point
MacOSに手動でマウントする方法の例:
$ sudo mount_udf -b 4096 /dev/diskN /Volumes/MountPoint
悲しいことに、512より異なるブロックサイズのすべてのものは、Windows XPにマウントされていないようです。
詳細については、#12、#13、#16、#31を参照してください。
UDF形式の最大2^32ブロックがあります。 Format-udfを使用すると、これらのブロックは論理ブロックに相当します。
ドライブの最大サイズを超える容量がある場合、追加容量は使用されません。これは、UDF自体の制限です。
最大OS互換性の場合、512バイトの論理ブロックサイズを持つデバイスでフォーマットudfを使用します。これにより、総容量が2つのTIBに制限されますが、結果のデバイスは最もオペレーティングシステムで動作するはずです。
最大結果のUDFファイルシステム容量の場合、4096バイトの論理ブロックサイズのデバイスでFormat-UUDFを使用します。これにより、総容量(2 TIBから)が16 TIBに増加しますが、結果のデバイスをマウント/読み取り/書き込みできるオペレーティングシステムの数/種類を制限します。詳細については、上記の互換性表を参照してください。
人間の読み取り可能なデバイスラベルの場合、次の構成のいずれかでフォーマットudfを使用します。
fdiskを使用して、BIOSがパーティションレスドライブから起動できない場合、パーティションをアクティブとして設定できます。 ( @tome-に感謝します - ヒントについて。)