Format a USB flash drive using gpart

Wojciech Puchar wojtek at wojtek.tensor.gdynia.pl
Mon Jul 9 10:26:26 UTC 2012


> If you're talking about an MS-DOS disk, then yes, it contains
> a DOS partition which is formatted. In FreeBSD, we would call
> it a slice (slice == "DOS primary partition"). In this case,
> there is no (sub)partitioning, the _slice_ carries the MS-DOS

unless you need windows 98 support partitionless USB drives works 
absolutely fine

clear it out

dd if=/dev/zero of=/dev/da0 bs=64k count=1


format

newfs_msdos /dev/da0

>> Same question for CDs?
>
> Not sure. A CD contains an ISO-9660 file system without an
> enclosing partition per se.
>
In FreeBSD (as well as NetBSD, OpenBSD, maybe linux) CD is just block 
device. You may make disklabel on it, and whatever you like.


In excuse of OS (windows) CD/DVD MUST BE CD9660 or UDF formatted without 
partitions.

You may record NTFS formatted DVD, perfectly readable on FReeBSD, 
unreadable under windows in spite it is windows native filesystem.

------
You may actually make "hybrid" DVD that will show whatever you want under 
windoze, and have real data in tar format.

below the recipe:

1) prepare windows-vizible layout, all needed viruses and autorun.inf in 
some directory and do

mkisofs -J -q .|dd of=/path/to/tempfile bs=512 skip=1

2)

tar cf - /path/to/tempfile ...list of what you want to be tarred...|growisofs -dvd-compat -Z /dev/cd0=-


now use tar to read files from that DVD, while in windows it will run 
viruses properly.


>> a virtual partition?
>
> As devices and "real files" are "quite the same", you can mount
> a file system that is contained in a file. You typically do this
> when doing data recovery and forensic analysis, where your starting
> point is an image file of a disk, a slice or a partition. You
> then "connect" it to a virtual node (vnconfig - e. g. md0) and

vnconfig is quite in old FreeBSD
today it is mdconfig



More information about the freebsd-questions mailing list