Format a USB flash drive using gpart

Polytropon freebsd at
Mon Jul 9 10:16:11 UTC 2012

On Sun, 08 Jul 2012 23:27:23 -0400, Thomas Mueller wrote:
> You mean the non-subdivided 1.44 MB or other capacity of a floppy
> is called a partition?

Let's try to use the correct terminology.

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
file system here. You know that MS-DOS does not have support
for partitioning.

> Same question for CDs?

Not sure. A CD contains an ISO-9660 file system without an
enclosing partition per se.

If we look back into OS history, we find the magical 'c' partition.
Historically, partition letters have been reserved for specific
purposes: the 'a' partition means a bootable partition, 'b' is
a swap partition, and 'c' is "the whole disk", refering either
to the disk device (da0c == da0) or the whole slice (da0s1c == da0s1).

You _can_ put a UFS file system, even many of them, on a CD, that
is possible, but don't expect any "Windows" to be able to deal
with it. :-)

> Also, a file system can be contained in an image file.  Or is this
> 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
then you mount it as if it was a device file.

> Might 
>  # tar xf /dev/da0
> work in other BSDs or even other (quasi-)Unixes including Linux,
> using the appropriate device name where applicable in place of da0?

That's quite possible. I've been speaking about tar as "the most
universal file system which isn't one" -- I've been using it on
floppies many many years ago, to transfer data among Sun Sparcstations,
Linux workstations and a BSD server. It's important not to use
any "fancy" tar features, and of course you need to know the
device names corresponding to the floppy drive which differ
across the systems, but it is possible to first use fdformat,
then tar cf, then tar xf. This of course happened before the
dawn of networking. :-)

> While that particular construst could probably not be booted,
> it is possible to boot from a floppy or image file that does
> not contain a file system.

For bare booting, a file system isn't that essential. You just
have to make sure the "boot chain" is properly resolved, such
as for example the FreeBSD boot mechanism works. You can read
more about it in "man 8 boot".

> Some of the disk images on the System Rescue CD (
> are not viewable/mountable as file systems.

I haven't looked into this particular one, but that is very well
possible. A CD doesn't _need_ to be in a ISO-9660 format (even
though it's the default data format). The _implementation_ of
the boot mechanism matters: it could even select from several
different boot images stored in some arbitrary (but addressable)
manner on the CD.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list