initialize msdosfs on memory stick?

Gary Aitken vagabond at
Fri Sep 13 00:18:14 UTC 2013

On 09/12/13 16:26, Polytropon wrote:
> On Thu, 12 Sep 2013 16:13:11 -0600, Gary Aitken wrote:
>> On 09/12/13 15:51, Polytropon wrote:
>>> On Thu, 12 Sep 2013 15:39:26 -0600, Gary Aitken wrote:
>>>> I can't seem to find how to do this in the handbook or man pages.
>>>> I need to initialize a usb memory stick with an msdos file system.
>>>> Is it possible, or do I have to find a windoze system?
>>> It is possible. The OS provides the newfs_msdos tool.
>>> There is no need to deal with "Windows" for this task.
>> Great, thanks.
>> I checked the newfs manpage but didn't look too carefully when the summary
>> line said "construct a new UFS1/UFS2 file system"
> That's correct: newfs "refers to newfs_ufs" (which obviously
> initializes a UFS file system), but there are other newfs_*
> just as there are corresponding (and more) mount_* commands.
> See "man newfs_msdos" for more details.

I see that; but was surprised newfs didn't see-also newfs_msdosfs.

Anyhoo...  ugh, I think I just screwed it up, not thinking things through.

After doing 

# newfs_msdos -F 32 -S 4096 /dev/da0
newfs_msdos: trim 62 sectors to adjust to a multiple of 63
/dev/da0: 979584 sectors in 30612 FAT32 clusters (131072 bytes/cluster)
BytesPerSec=4096 SecPerClust=32 ResSectors=4 FATs=2 Media=0xf0 SecPerTrack=63 Heads=255 HiddenSecs=0 HugeSectors=979650 FATsecs=30 RootCluster=2 FSInfo=1 Backup=2

I can't mount it, and there are no partitions:

# ls /dev/da0*
# mount -t msdosfs /dev/da0 /mnt/memstick
mount_msdosfs: /dev/da0: Invalid argument

Normally there is a /dev/da0s1.

I suspect I *should* have used /dev/da0s1 in the newfs_msdos cmd.

So, attempting to re-establish the partitions:

#gpart create -s MBR da0
da0 created
# gpart show -l da0
=>     63  7837633  da0  MBR  (3.8G)
       63  7837633       - free -  (3.8G)
# gpart add -t mbr da0
gpart: Invalid argument

now what?
Is mbr the wrong kind of partition type?
man gpart indicates the MBR scheme requires the GEOM_PART_MBR kernel option;
since the create succeeded, I'm assuming this is present?

More information about the freebsd-questions mailing list