สคริปต์ทุบตีเพื่อจัดรูปแบบอุปกรณ์บล็อก (ฮาร์ดไดรฟ์หรือแฟลชไดรฟ์) ใน UDF เอาต์พุตเป็นไดรฟ์ที่สามารถใช้สำหรับการอ่าน/การเขียนในหลายตระกูลระบบปฏิบัติการ: Windows, MacOS และ Linux สคริปต์นี้ควรมีความสามารถในการรันใน MacOS หรือใน Linux
สำหรับผู้ใช้ขั้นสูง Format-UDF ยังสามารถจัดรูปแบบพาร์ติชันที่มีอยู่เดียวโดยไม่ต้องแก้ไขตารางพาร์ติชัน ระวังว่าการใช้วิธีนี้จะทำให้พาร์ติชัน UDF ที่จัดรูปแบบใหม่ใช้งานไม่ได้บน MacOS (แต่ยังคงใช้งานได้บน Linux และ Windows) (ดู #24 สำหรับข้อแม้) เนื่องจากข้อ จำกัด นี้คำแนะนำคือการจัดรูปแบบอุปกรณ์ทั้งหมด
Format-UDF ถูกสร้างขึ้นเพื่อจัดการกับนิสัยใจคอเฉพาะของระบบปฏิบัติการที่ป้องกันไม่ให้อุปกรณ์ UDF ที่มีรูปแบบไร้เดียงสาจากการทำงานในระบบปฏิบัติการต่างๆ นี่คือปัจจัยบางอย่างที่ซับซ้อนซึ่ง Format-UDF มีจุดมุ่งหมายที่จะเป็นนามธรรมออกไป:
เมื่อมองแวบแรกข้อ จำกัด เหล่านี้ดูเหมือนจะมีความขัดแย้งบางส่วน การแก้ปัญหาตามที่ Pieter แนะนำคือวางตารางพาร์ติชันปลอม (ผ่าน MBR) ในบล็อกแรกของไดรฟ์ซึ่งแสดงพาร์ติชันพาร์ติชันทั้งหมดเดียว สิ่งนี้ใช้ได้ผลเพราะ UDF (อาจตั้งใจ) ไม่ได้ใช้บล็อกแรก น่าเสียดายที่ไม่มีวิธีง่ายๆในการทำเช่นนี้ในขณะที่เล่นกลแปรี้ตัวแปรอื่น ๆ ทั้งหมด (เช่นขนาดบล็อกของอุปกรณ์ลอจิคัล) Format-UDF เขียน MBR ปลอมเพื่อเพิ่มความเข้ากันได้บน Windows หากนี่ไม่ใช่สิ่งที่คุณต้องการคุณสามารถปิดการใช้งาน MBR ด้วย -p none
เป้าหมายของโครงการนี้คือ การให้การเข้าถึงระบบไฟล์ข้ามแพลตฟอร์มด้วยคุณสมบัติที่ทันสมัย ในลักษณะที่เป็น:
ระบบปฏิบัติการบางอย่างไม่สนับสนุน UDF ตารางรายละเอียดของตารางต่อไปนี้รองรับ UDF ข้อมูลถูกดัดแปลงจาก https://en.wikipedia.org/wiki/universal_disk_format#compatibility (ดังที่สืบค้นเมื่อ 2017-06-16)
ทั้งการอ่าน/เขียนได้รับการสนับสนุนเว้นแต่จะแสดงรายการด้านล่าง
| ระบบปฏิบัติการ | อ่านอย่างเดียว | บันทึก |
|---|---|---|
| Windows XP, Server 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 Revision 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
รายละเอียดของตารางต่อไปนี้รองรับ Windows สำหรับไดรฟ์ 4K ข้อมูลถูกดัดแปลงจากนโยบายการสนับสนุนของ Microsoft สำหรับฮาร์ดไดรฟ์ภาค 4K ใน Windows (เรียกคืนเมื่อ 2017-06-16) ซ้อนทับลงในตารางนี้คือการทดสอบผลลัพธ์จากชุมชน Format-UDF (ขอขอบคุณเป็นพิเศษกับ @pali สำหรับการทดสอบของเขาใน XP)
| ขนาด / ระบบปฏิบัติการ | พื้นเมือง 512 ไบต์ | 512 การเลียนแบบ (aka "512E") | 4K พื้นเมือง (aka "4kn") |
|---|---|---|---|
| ขนาดบล็อกตรรกะ | 512 ไบต์ | 512 ไบต์ | 4096 ไบต์ |
| ขนาดบล็อกทางกายภาพ | 512 ไบต์ | 4096 ไบต์ | 4096 ไบต์ |
| ไฟล์ UDF สูงสุด ความจุของระบบ | 2 TIB | 2 TIB | 16 TIB |
| Windows XP | สนับสนุน; ผลงาน | ไม่ได้รับการสนับสนุน; ไม่ทำงาน | ไม่ได้รับการสนับสนุน; ไม่ทำงาน |
| Windows XP Pro x64 เซิร์ฟเวอร์ 2003 เซิร์ฟเวอร์ 2003 R2 | สนับสนุน; มีแนวโน้มที่จะทำงาน แต่ยังไม่ทดลอง | ไม่ได้รับการสนับสนุน | ไม่ได้รับการสนับสนุน |
| Windows Vista, เซิร์ฟเวอร์ 2008 | สนับสนุน; มีแนวโน้มที่จะทำงาน แต่ยังไม่ทดลอง | สนับสนุน; มีแนวโน้มที่จะทำงาน แต่ยังไม่ทดลอง | ไม่ได้รับการสนับสนุน |
| Windows 7, เซิร์ฟเวอร์ 2008 R2 | สนับสนุน; มีแนวโน้มที่จะทำงาน แต่ยังไม่ทดลอง | สนับสนุน; มีแนวโน้มที่จะทำงาน แต่ยังไม่ทดลอง | ไม่ได้รับการสนับสนุน |
| Windows 8, เซิร์ฟเวอร์ 2555 | สนับสนุน; มีแนวโน้มที่จะทำงาน แต่ยังไม่ทดลอง | สนับสนุน; มีแนวโน้มที่จะทำงาน แต่ยังไม่ทดลอง | สนับสนุน; มีแนวโน้มที่จะทำงาน แต่ยังไม่ทดลอง |
| Windows 8.1 เซิร์ฟเวอร์ 2012 r2 | สนับสนุน; มีแนวโน้มที่จะทำงาน แต่ยังไม่ทดลอง | ไม่ได้รับการสนับสนุน | ไม่ได้รับการสนับสนุน |
| Windows 10, เซิร์ฟเวอร์ 2016 | สนับสนุน; มีแนวโน้มที่จะทำงาน แต่ยังไม่ทดลอง | ไม่ได้รับการสนับสนุน | สนับสนุน; มีแนวโน้มที่จะทำงาน แต่ยังไม่ทดลอง |
หากคุณได้ทำการทดสอบและต้องการอัปเดตตารางนี้เพื่อเป็นประโยชน์ต่อผู้ใช้ในอนาคตของ Format-UDF โปรดส่งคำขอดึง โปรดระบุลิงก์ไปยังข้อมูลดิบหรือผลการทดสอบของคุณ
printfxxdblockdev , ioregblockdev , diskutillsblk , diskutilumount , diskutilmkudffs , newfs_udfในการติดตั้งข้อกำหนดเบื้องต้นที่จำเป็นบน Ubuntu:
sudo apt-get install udftools coreutils vim-common
Format-UDF เป็นสคริปต์ที่มีอยู่ในตัวเอง เพียงคัดลอก Format-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-UDF จะพยายามตรวจจับและใช้ขนาดบล็อกที่ถูกต้อง (ตรรกะ) หากคุณรู้ว่าคุณกำลังทำอะไรตัวเลือก Format -UDF -b BLOCK_SIZE สามารถใช้เพื่อแทนที่ค่าขนาดบล็อกที่ตรวจพบได้อย่างชัดเจน
หากใช้ขนาดบล็อกผิดในขณะที่การจัดรูปแบบ (เช่นที่ไม่ตรงกับขนาดบล็อกตรรกะของไดรฟ์ของคุณ) ไดรฟ์ผลลัพธ์น่าจะมีปัญหาความเข้ากันได้ของระบบปฏิบัติการและประสบปัญหาประสิทธิภาพที่ไม่เหมาะสม
ในทำนองเดียวกันมันเป็นสิ่งสำคัญที่จะต้องติดตั้งไดรฟ์ผลลัพธ์โดยใช้ขนาดบล็อกที่ถูกต้อง ระบบปฏิบัติการจำนวนมากจะลองใช้ขนาดบล็อกเดียวเท่านั้น ตัวอย่างเช่นในการติดตั้งอุปกรณ์ UDF ดูเหมือนว่า Windows จะต้องใช้ระบบไฟล์ UDF ใช้ขนาดบล็อกเท่ากับขนาดบล็อกแบบลอจิคัล หากขนาดบล็อกของคุณไม่ใช่ค่าเริ่มต้นของระบบปฏิบัติการการติดตั้งอัตโนมัติจะไม่ทำงานกับระบบปฏิบัติการของคุณ ในขณะที่ความรำคาญเล็ก ๆ น้อย ๆ ความพยายามในการติดตั้งด้วยตนเองควรประสบความสำเร็จสำหรับขนาดบล็อกที่ไม่เป็นมาตรฐาน
ตัวอย่างวิธีการเมานต์ด้วยตนเองบน 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 เอง
สำหรับความเข้ากันได้ของระบบปฏิบัติการสูงสุดให้ใช้ Format-UDF บนอุปกรณ์ที่มีขนาดบล็อกตรรกะ 512 ไบต์ สิ่งนี้จะ จำกัด กำลังการผลิตทั้งหมดของคุณเป็น 2 TIB แต่อุปกรณ์ผลลัพธ์ควรทำงานกับระบบปฏิบัติการมากที่สุด
สำหรับความจุของระบบไฟล์ UDF ที่เป็นผลลัพธ์สูงสุดให้ใช้ Format-UDF บนอุปกรณ์ที่มีขนาดบล็อกโลจิคัล 4096 ไบต์ สิ่งนี้จะเพิ่มกำลังการผลิตทั้งหมดของคุณ (จาก 2 TIB) เป็น 16 TIB แต่จะ จำกัด จำนวน/ประเภทของระบบปฏิบัติการที่จะสามารถติดตั้ง/อ่าน/เขียนอุปกรณ์ผลลัพธ์ได้ ดูตารางความเข้ากันได้ด้านบนสำหรับรายละเอียดเพิ่มเติม
สำหรับฉลากอุปกรณ์ที่มนุษย์อ่านได้ให้ใช้ Format-UDF ในหนึ่งในการกำหนดค่าต่อไปนี้:
fdisk เพื่อตั้งค่าพาร์ติชั่นได้หาก BIOS ของคุณไม่สามารถบูตจากไดรฟ์ที่ไม่มีพาร์ติชันได้ (ขอบคุณ @tome- สำหรับเคล็ดลับ)