Skip to content

Commit d31064d

Browse files
committed
Update usage and examples
1 parent 16a5801 commit d31064d

File tree

1 file changed

+61
-37
lines changed

1 file changed

+61
-37
lines changed

README.md

+61-37
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,14 @@ format-udf is a self-contained script. Simply copy format-udf.sh to a directory
115115

116116
# Usage
117117
```
118+
Bash script to format a block device (hard drive or Flash drive) in UDF.
119+
The output is a drive that can be used for reading/writing across multiple
120+
operating system families: Windows, macOS, and Linux.
121+
This script should be capable of running in macOS or in Linux.
122+
118123
Usage: ./format-udf.sh [-b BLOCK_SIZE] [-f] [-p PARTITION_TYPE] [-w WIPE_METHOD] device label
124+
./format-udf.sh -v
125+
./format-udf.sh -h
119126
120127
-b BLOCK_SIZE
121128
Block size to be used during format operation.
@@ -127,14 +134,20 @@ Usage: ./format-udf.sh [-b BLOCK_SIZE] [-f] [-p PARTITION_TYPE] [-w WIPE_METHOD
127134
Forces non-interactive mode. Useful for scripting.
128135
Please use with caution, as no user confirmation is given.
129136
137+
-h
138+
Display help information and exit.
139+
130140
-p PARTITION_TYPE
131141
Partition type to set during format operation.
132142
Currently supported types include: mbr, none
133143
mbr - Master boot record (default)
134144
none - Do not modify partitions
135145
If absent, defaults to 'mbr'.
136146
See also:
137-
https://github.com/JElchison/format-udf#a-fake-partition-table-to-fake-out-windows
147+
https://github.com/JElchison/format-udf#why
148+
149+
-v
150+
Display version information and exit.
138151
139152
-w WIPE_METHOD
140153
Wipe method to be used before format operation.
@@ -156,100 +169,111 @@ Usage: ./format-udf.sh [-b BLOCK_SIZE] [-f] [-p PARTITION_TYPE] [-w WIPE_METHOD
156169
label
157170
Label to apply to formatted device.
158171
159-
Example: ./format-udf.sh sdg "My External Drive"
172+
Example: ./format-udf.sh sdg "My UDF External Drive"
160173
```
161174

162175

163176
### Example usage
164177
On Ubuntu:
165178
```
166179
user@computer:~$ ./format-udf.sh sdg "My UDF External Drive"
180+
[+] Validating arguments...
167181
[+] Testing dependencies...
182+
[+] Looking for drive info tool... using /sbin/blockdev
168183
[+] Looking for drive listing tool... using /sbin/blockdev
184+
[+] Looking for drive summary tool... using /sbin/blkid
169185
[+] Looking for unmount tool... using /bin/umount
170186
[+] Looking for UDF tool... using /usr/bin/mkudffs
171-
[+] Parsing options...
172-
[+] Validating arguments...
173-
[+] Gathering drive information...
187+
[+] Detecting logical block size...
174188
[sudo] password for user:
175-
/dev/sdg: LABEL="Old Drive" TYPE="udf"
176-
HTS721010G9SA00
189+
[*] Detected logical block size of 512
190+
[+] Validating detected logical block size...
191+
[+] Detecting physical block size...
192+
[*] Detected physical block size of 512
193+
[+] Validating detected physical block size...
194+
[+] Validating file system block size...
195+
[*] Using file system block size of 512
196+
[+] Detecting total size...
197+
[*] Detected total size of 31040995328
198+
[+] Validating detected total size...
199+
[+] Gathering drive information...
200+
/dev/sdg: UUID="41A4EE1A20286d61" LABEL="Old Drive" TYPE="udf" PTTYPE="dos"
201+
177202
RO RA SSZ BSZ StartSec Size Device
178-
rw 256 512 4096 0 100030242816 /dev/sdg
203+
rw 256 512 4096 0 31040995328 /dev/sdg
204+
rw 256 512 512 0 31040995328 /dev/sdg1
179205
The above-listed device (and partitions, if any) will be completely erased.
180206
Type 'yes' if this is what you intend: yes
181-
[+] Detecting total size...
182-
[*] Using total size of 100030242816
183-
[+] Validating detected total size...
184-
[+] Detecting physical block size...
185-
[*] Using block size of 512
186-
[+] Validating detected block size...
187207
[+] Unmounting device...
188208
umount: /dev/sdg: not mounted
189209
[+] Zeroing out first chunk of device...
190210
4096+0 records in
191211
4096+0 records out
192-
2097152 bytes (2.1 MB) copied, 0.531167 s, 3.9 MB/s
212+
2097152 bytes (2.1 MB, 2.0 MiB) copied, 0.240331 s, 8.7 MB/s
193213
[+] Formatting /dev/sdg ...
194214
start=0, blocks=64, type=RESERVED
195215
start=64, blocks=12, type=VRS
196216
start=76, blocks=180, type=USPACE
197217
start=256, blocks=1, type=ANCHOR
198218
start=257, blocks=16, type=PVDS
199219
start=273, blocks=1, type=LVID
200-
start=274, blocks=195371037, type=PSPACE
201-
start=195371311, blocks=1, type=ANCHOR
202-
start=195371312, blocks=239, type=USPACE
203-
start=195371551, blocks=16, type=RVDS
204-
start=195371567, blocks=1, type=ANCHOR
220+
start=274, blocks=60626413, type=PSPACE
221+
start=60626687, blocks=1, type=ANCHOR
222+
start=60626688, blocks=239, type=USPACE
223+
start=60626927, blocks=16, type=RVDS
224+
start=60626943, blocks=1, type=ANCHOR
205225
[+] Writing fake MBR...
206226
16+0 records in
207227
16+0 records out
208-
16 bytes (16 B) copied, 0.00259109 s, 6.2 kB/s
228+
16 bytes copied, 0.0219986 s, 0.7 kB/s
209229
2+0 records in
210230
2+0 records out
211-
2 bytes (2 B) copied, 0.000108835 s, 18.4 kB/s
212-
[+] Successfully formatted /dev/sdg: LABEL="My UDF External Drive" TYPE="udf"
231+
2 bytes copied, 0.000358472 s, 5.6 kB/s
232+
[+] Successfully formatted /dev/sdg: UUID="59467176LinuxUDF" LABEL="My UDF External Drive" TYPE="udf" PTTYPE="dos"
213233
Please disconnect/reconnect your drive now.
214234
```
215235

216236
On macOS:
217237
```
218238
computer:~ user$ ./format-udf.sh disk2 "My UDF External Drive"
239+
[+] Validating arguments...
219240
[+] Testing dependencies...
241+
[+] Looking for drive info tool... using /usr/sbin/ioreg
220242
[+] Looking for drive listing tool... using /usr/sbin/diskutil
243+
[+] Looking for drive summary tool... using (none)
221244
[+] Looking for unmount tool... using /usr/sbin/diskutil
222245
[+] Looking for UDF tool... using /sbin/newfs_udf
223-
[+] Parsing options...
224-
[+] Validating arguments...
246+
[+] Detecting logical block size...
247+
[*] Detected logical block size of 512
248+
[+] Validating detected logical block size...
249+
[+] Detecting physical block size...
250+
[+] Validating file system block size...
251+
[*] Using file system block size of 512
252+
[+] Detecting total size...
253+
[*] Detected total size of 31040995328
254+
[+] Validating detected total size...
225255
[+] Gathering drive information...
226-
/dev/disk2
256+
/dev/disk2 (external, physical):
227257
#: TYPE NAME SIZE IDENTIFIER
228-
0: Old Drive *100.0 GB disk2
258+
0: Old Drive *31.0 GB disk2
229259
The above-listed device (and partitions, if any) will be completely erased.
230260
Type 'yes' if this is what you intend: yes
231-
[+] Detecting total size...
232-
[*] Using total size of 100030242816
233-
[+] Validating detected total size...
234-
[+] Detecting physical block size...
235-
[*] Using block size of 512
236-
[+] Validating detected block size...
237261
[+] Unmounting device...
238262
Password:
239263
Unmount of all volumes on disk2 was successful
240264
[+] Zeroing out first chunk of device...
241265
4096+0 records in
242266
4096+0 records out
243-
2097152 bytes transferred in 0.592766 secs (3537908 bytes/sec)
267+
2097152 bytes transferred in 2.971664 secs (705716 bytes/sec)
244268
[+] Formatting /dev/disk2 ...
245-
write to block device: /dev/disk2 last written block address: 195371567
269+
write to block device: /dev/disk2 last written block address: 60626943
246270
[+] Writing fake MBR...
247271
16+0 records in
248272
16+0 records out
249-
16 bytes transferred in 0.044496 secs (360 bytes/sec)
273+
16 bytes transferred in 0.034208 secs (468 bytes/sec)
250274
2+0 records in
251275
2+0 records out
252-
2 bytes transferred in 0.000602 secs (3322 bytes/sec)
276+
2 bytes transferred in 0.002100 secs (952 bytes/sec)
253277
[+] Successfully formatted
254278
Please disconnect/reconnect your drive now.
255279
```

0 commit comments

Comments
 (0)