Format a USB flash drive using gpart

Polytropon freebsd at
Sun Jul 8 13:37:40 UTC 2012

On Sun, 08 Jul 2012 14:27:05 +0100, Bruce Cran wrote:
> On 08/07/2012 13:30, Polytropon wrote:
> > With few routine, tasks are performed more natural using
> > the desired CLI tools. You don't go "Now I have to remember
> > which command to format the disk", you just format the disk,
> > which means "spaking to" newfs. The more often you do it,
> > the more obvious the tools are, and they won't change in
> > look and feel (or options). That makes them superior.
> How do you format a FAT32 partition? newfs won't work. Is it newfs_vfat, 
> newfs_fat32, newfs_msdos etc.? And how do you specify you want FAT32 
> instead of FAT12 or FAT16?

In such cases, you use the _proper_ CLI tools for that job.
As I said, those are typically specific to the file system
one wants to use, and depending on the file system design,
there may be options that are individual to those tools.
For every fs-related task, there is a system-level tool
that does the job.

> With a good GUI tool like diskmgmt.msc in 
> Windows 2008 you simply right-click the partition and click "New Volume" 
> to create a new partition, or "Format" to format it - and then follow 
> the prompts. 

And of course you cannot create UFS partitions that way. :-)

I still remember the "initalize disk" function from the original
Amiga or Atari ST graphical interfaces. They were bound to those
systems and their supported file systems. Intending to have
something similar (a GUI) for UNIX and Linux would be possible,
but very complicated "under the hood", and it would be even more
complicated to make all that power utilizable to a novice user.
In that specific case, reasonable defaults would have to be
provided, which typically fail in edge cases. This is where you
use the power of CLI.

Another advantage: It's less interactive, giving you potential
for automating tasks. "Follow the prompts" might even be too
complicated for some kinds of users. :-)

> Of course using diskpart is faster if you know the 
> commands and parameters, but for an ordinary user adding a new disk 
> maybe once a year it's most likely more efficient to just use the GUI.

If the GUI takes the considerations about file system and media
type (and their implications) into mind -- no problem. Sadly, I
don't know of a tool yet that exactly works that way.

Especially in "trial & error" scenarios the CLI is simpler in
use. For example, you compose a newfs command. Then you apply
it. Not happy with the result? Recall the command from the
command line history, change the parameters you want, and then
try again. It's surely harder to do that within a GUI. :-)

On the other hand, a proper tool would efficiently visualize
the content of a disk, showing how slices and partitions are
laid out and what options they have. This is a real benefit
in testing scenarios where you need a quick overview of the
status quo.

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

More information about the freebsd-questions mailing list