# Problems mounting usb flash-drive



## mikethe1wheelnut (Feb 2, 2022)

I'm trying to save files to a perfectly ordinary brand-new usb-key.  Please consider this documentation of things I've tried.  I'm not stymied or pulling my hair out yet.  Yet  One of my next steps is to consult the handbook.  (I always try google first, in the off-chance it'll land me right on it) -the error I get is attached.


```
root@ozzie:~ # fdisk /dev/da0
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=3773 heads=255 sectors/track=63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=3773 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 12 (0x0c),(DOS or Windows 95 with 32 bit FAT (LBA))
    start 128, size 60628864 (29603 Meg), flag 0
	beg: cyl 0/ head 1/ sector 1;
	end: cyl 628/ head 64/ sector 1
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
```


```
root@ozzie:~ # ls /dev/da*
/dev/da0	/dev/da0s1
```


```
root@ozzie:~ # mount_msdosfs /dev/da0s1 /media/usb
mount_msdosfs: /media/usb: No such file or directory
```


```
root@ozzie:~ # mount /dev/da0s1 /media/usb
mount: /media/usb: No such file or directory
```


```
root@ozzie:~ # mount /dev/da0 /media/usb
mount: /media/usb: No such file or directory
root@ozzie:~ # mount_msdosfs /dev/da0 /media/usb
mount_msdosfs: /media/usb: No such file or directory
```


```
root@ozzie:~ # mount /dev/da0
mount: /dev/da0: unknown special file or file system
```


```
root@ozzie:~ # mount /dev/da0s1
mount: /dev/da0s1: unknown special file or file system
```
selected output from dmesg:

```
ugen0.3: <vendor 0x1a40 USB 2.0 Hub> at usbus0
uhub3 on uhub0
uhub3: <vendor 0x1a40 USB 2.0 Hub, class 9/0, rev 2.00/1.11, addr 19> on usbus0
uhub3: 4 ports with 4 removable, self powered
ugen0.4: <vendor 0x6557 USB DISK 2.0> at usbus0
umass0 on uhub3
umass0: <vendor 0x6557 USB DISK 2.0, class 0/0, rev 2.00/1.00, addr 26> on usbus0
umass0:  SCSI over Bulk-Only; quirks = 0xc100
umass0:2:0: Attached to scbus2
da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
da0: < USB DISK 2.0 PMAP> Removable Direct Access SPC-4 SCSI device
da0: Serial Number 90009B838C2AC448
da0: 40.000MB/s transfers
da0: 29604MB (60628992 512 byte sectors)
da0: quirks=0x3<NO_SYNC_CACHE,NO_6_BYTE>
```


```
root@ozzie:~ # usbconfig
...
ugen0.4: <vendor 0x6557 USB DISK 2.0> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (200mA)
...
```


----------



## covacat (Feb 2, 2022)

[ -d /media/usb ] || mkdir -p /media/usb
mount -t msdosfs /dev/da0s1 /media/usb

if it fails
file -s /dev/da0s1

you need bourne (sh shell) for the first line to work
otherwise just verify that /media/usb exists


----------



## mikethe1wheelnut (Feb 2, 2022)

covacat said:


> [ -d /media/usb ] || mkdir -p /media/usb
> mount -t msdosfs /dev/da0s1 /media/usb
> 
> if it fails
> ...



very interesting.  before, in thunar, it showed:

```
/media/USB_DISK_2.0_07009AE05ECE6E14_s1/
```
..I've seen that before, through the command-line, though I don't recall how I got it to show me all that.
now, it -also- displays

```
/media/usb
```
..trying to move files to it gives the attached error:
..that's probably because, from the desktop, I'm not root.  So now all I have to do it figure out file-transfer via the command-line (I've done this before..  way back when..), or how to get my local user the necessary permissions.  ..and hope that the resulting files will be readable by other operating systems.

.. looks like this should do the trick: https://befused.com/copy-an-entire-directory-in-freebsd/ 

thanks!


----------



## mikethe1wheelnut (Feb 2, 2022)

mikethe1wheelnut said:


> I'm trying to save files to a perfectly ordinary brand-new usb-key.  Please consider this documentation of things I've tried.  I'm not stymied or pulling my hair out yet.  Yet  One of my next steps is to consult the handbook.  (I always try google first, in the off-chance it'll land me right on it) -the error I get is attached.
> 
> 
> ```
> ...



reminder of how to navigate to folders on the usb:

```
root@ozzie:~ # ls
.cshrc		.history	.k5login	.login		.profile	xorg.conf.new
root@ozzie:~ # cd /media
root@ozzie:/media # ls
Seagate_Expansion_NAATTNKZ_s1		USB_DISK_2.0_07009AE05ECE6E14_s1	USB_DISK_2.0_07009B2D992ADF02_s2
Seagate_Expansion_NAATTNKZ_s11		USB_DISK_2.0_07009AE05ECE6E14_s11	usb
```
-note the addition of "usb" to the list..  ..and the presence of seagate expansion..  that's an external hard-drive (I think) that isn't currently connected to the computer, so it's listing in media seems a mystery..


----------



## mikethe1wheelnut (Feb 2, 2022)

mikethe1wheelnut said:


> reminder of how to navigate to folders on the usb:
> 
> ```
> root@ozzie:~ # ls
> ...



hmm..

```
root@ozzie:/media/usb # mkdir files_from_freebsd
mkdir: files_from_freebsd: Device not configured
root@ozzie:/media/usb # cd ../USB_DISK_2.0_07009AE05ECE6E14_s1
root@ozzie:/media/USB_DISK_2.0_07009AE05ECE6E14_s1 # mkdir files_from_freebsd
mkdir: files_from_freebsd: Device not configured
```
still following instructions/suggestions in the handbook:

```
root@ozzie:~ # mount /dev/da0 /media/usb
mount: /dev/da0: No such file or directory
root@ozzie:~ # mount /media/usb
mount: /media/usb: unknown special file or file system
root@ozzie:~ # mount /media/USB_DISK_2.0_07009AE05ECE6E14_s1
mount: /media/USB_DISK_2.0_07009AE05ECE6E14_s1: unknown special file or file system
```
ah?

```
root@ozzie:~ # mount_msdosfs /dev/da0s1 /media/usb
root@ozzie:~ # ls
.cshrc		.history	.k5login	.login		.profile	xorg.conf.new
root@ozzie:~ # cd /media
root@ozzie:/media # ls
Seagate_Expansion_NAATTNKZ_s1		USB_DISK_2.0_07009AE05ECE6E14_s1	USB_DISK_2.0_07009B2D992ADF02_s2
Seagate_Expansion_NAATTNKZ_s11		USB_DISK_2.0_07009AE05ECE6E14_s11	usb
root@ozzie:/media # cd usb
root@ozzie:/media/usb # mkdir files_from_freebsd
root@ozzie:/media/usb # ls
files_from_freebsd
```
fascinating.. if I didn't know better (..I don't..), I'd say there are multiple mount points for the same file system..

```
root@ozzie:/media/usb # cd
root@ozzie:~ # mount_msdosfs /dev/da0s1 /media/USB_DISK_2.0_07009AE05ECE6E14_s1
mount_msdosfs: /dev/da0s1: Device busy
root@ozzie:~ # umount /dev/da0s1
root@ozzie:~ # mount_msdosfs /dev/da0s1 /media/USB_DISK_2.0_07009AE05ECE6E14_s1
root@ozzie:~ # umount /dev/da0s1
root@ozzie:~ # mount /dev/da0s1 /media/USB_DISK_2.0_07009AE05ECE6E14_s1
mount: /dev/da0s1: No such file or directory
root@ozzie:~ # mount_msdosfs /dev/da0s1 /media/USB_DISK_2.0_07009AE05ECE6E14_s1
root@ozzie:~ # cd /media/usb
root@ozzie:/media/usb # ls
root@ozzie:/media/usb # cd ../USB_DISK_2.0_07009AE05ECE6E14_s1
root@ozzie:/media/USB_DISK_2.0_07009AE05ECE6E14_s1 # ls
files_from_freebsd
```


----------



## Deleted member 30996 (Feb 2, 2022)

```
# mkdir -p /media/da0s1
# mount -v -t msdosfs /dev/da0s1 /media/da0s1
# umount -v -t msdosfs /dev/da0s1 /media/da0s1
```

This is how I've been doing it the past 12 years or so.









						Beginners Guide - How To Set Up A FreeBSD Desktop From Scratch
					

I'm going to guide you though the process of getting a fully functional FreeBSD 13.0-RELEASE desktop up and running, complete with system files and security settings, step-by-step as if you've never used UNIX or the command line. Now let's get started:  Insert your boot media and at the Welcome...




					forums.freebsd.org


----------



## SirDice (Feb 3, 2022)

mikethe1wheelnut said:


> ```
> root@ozzie:~ # fdisk /dev/da0
> ```


Please stop using fdisk(8), use gpart(8) instead. And show us the output of `gpart show da0`.


----------



## mikethe1wheelnut (Feb 3, 2022)

Trihexagonal said:


> ```
> # mkdir -p /media/da0s1
> # mount -v -t msdosfs /dev/da0s1 /media/da0s1
> # umount -v -t msdosfs /dev/da0s1 /media/da0s1
> ...


thanks!

..may I humbly suggest you communicate with the people in charge of the handbook so that this beginners guide features more prominently?  I don't think it popped up when I dove in the first time.  The ride could definitely have been smoother, and I make no claim I did it all properly, quite the converse..


----------



## mikethe1wheelnut (Feb 3, 2022)

SirDice said:


> Please stop using fdisk(8), use gpart(8) instead. And show us the output of `gpart show da0`.


as commanded!  

```
root@ozzie:~ # gpart show da0
=>       63  121110465  da0  MBR  (58G)
         63      60609       - free -  (30M)
      60672  121049856    1  fat32lba  (58G)
```
(..this is a fresh usb.. -same type if being larger capacity and usb 3.0 instead of 2.0 qualifies as the "same type"..)
..btw, I ended up getting the files successfully copied over, even though I didn't realize it.  I tried to un-mount the drive, it gave errors, and I gave up.  I then later stuck the usb into  my other laptop just to check what was there (I was labeling usb's to keep track of things) and to my surprise, all the files I had been trying to copy were there!  So now I'm back here in part to document how I finally did that..


----------



## mikethe1wheelnut (Feb 3, 2022)

mikethe1wheelnut said:


> as commanded!
> 
> ```
> root@ozzie:~ # gpart show da0
> ...


..woops.. I copied over a 1.1GB file just fine.. then when I went to copy over an 11GB file, it tells me the file is too large. ?  gpart show da0 shows right there that I have 58G..  and the 1.1 GB file wouldn't fit in 30M, so something funky is going on..  the 1.1 GB file is a zip archive.. could that be part of the problem?


----------



## jb_fvwm2 (Feb 3, 2022)

msdos files I think are limited to 2gb.


----------



## grahamperrin@ (Feb 4, 2022)

mikethe1wheelnut said:


> beginners guide



From the book of frequently asked questions:

8. Disks, File Systems, and Boot Loaders

Would you find it useful to have an answer there?

Side note

FreeBSD bug 261706 – FAT32 (LBA) misrepresented as a link in the manual page for gpart(8)


----------



## grahamperrin@ (Feb 4, 2022)

jb_fvwm2 said:


> msdos files I think are limited to 2gb.



Maybe relevant, 2019-08-26, vermaden wrote:



> FreeBSD project in the version 12.x removed the `-o large` option from `mount_msdosfs` …


----------



## mikethe1wheelnut (Feb 4, 2022)

grahamperrin said:


> From the book of frequently asked questions:
> 
> 8. Disks, File Systems, and Boot Loaders
> 
> ...


ok, I finally understood what you're actually asking.  yes!  (as long as google searches for "how to use usb with freebsd" or something equivalent, end up pointing to it..)  Close to: "How do I use a new removable drive?" would seem appropriate  ..perhaps below it as a special case?


----------



## grahamperrin@ (Feb 4, 2022)

mikethe1wheelnut said:


> … as long as google searches for "how to use usb with freebsd" or something equivalent, end up pointing to it. …



I doubt that Google search results would change significantly. 

<https://www.freebsd.org/search/> is the FreeBSD search page.


----------



## vermaden (Feb 4, 2022)

jb_fvwm2 said:


> msdos files I think are limited to 2gb.


The limit of *FAT32* (known as msdosfs on FreeBSD) is* 4 GB*.

To omit that limitation *exFAT* was created.


----------



## Deleted member 30996 (Feb 4, 2022)

mikethe1wheelnut said:


> thanks!
> 
> ..may I humbly suggest you communicate with the people in charge of the handbook so that this beginners guide features more prominently?  I don't think it popped up when I dove in the first time.


They are well aware of me and my work already. I'm a potential Pandporas Box they monitor closely..

It's been featured in freebsdnews.com twice.  Their spider got my post on another forum, bsdmag.org picked up their article and promoted it on their English and Arabic Facebook pages:






						TrueNAS - Welcome to the Open Storage Era
					

TrueNAS is the World’s #1 Open Source Storage. Based on OpenZFS, it is trusted by millions and deployed worldwide.




					www.freebsdnews.com
				




Siseneg is the name of my other bot. I have my own Facebook Education website ranked pages now, one for me and one for my domain where it's posted. They're listed in the About section of my Profile.


The second time it was featured in freebsdnews.com was the post I made here, featuring ILUXA's desktop: with the article.






						TrueNAS - Welcome to the Open Storage Era
					

TrueNAS is the World’s #1 Open Source Storage. Based on OpenZFS, it is trusted by millions and deployed worldwide.




					www.freebsdnews.com
				




Who left for good after being sanctioned when the community adopted their new paradigm of what is and is not acceptable behaviors ito meet Cable TV News broadcast guidelines regarding lies and personal attacks.



mikethe1wheelnut said:


> The ride could definitely have been smoother, and I make no claim I did it all properly, quite the converse..



I'm sorry about that. All my posts are Moderated and take some time to appear. You struggled on after I posted till a Mod had time to approve it as being acceptable for the Public to view.

I've been sanctioned and remain under threat of further sanctions if I don't adopt a submissive affect and honor those who lack it through silence.

The rewrite of it to use pkg instead of ports will appear on my site and should be done Monday. Check my Facebook pages.

This message is awaiting moderator approval, and is invisible to normal visitors.


----------



## mikethe1wheelnut (Feb 7, 2022)

Trihexagonal said:


> They are well aware of me and my work already. I'm a potential Pandporas Box they monitor closely..
> 
> It's been featured in freebsdnews.com twice.  Their spider got my post on another forum, bsdmag.org picked up their article and promoted it on their English and Arabic Facebook pages:
> 
> ...


I commend you for your continued efforts!  Somebody will benefit from them, I'm sure!


----------



## mikethe1wheelnut (Feb 25, 2022)

mikethe1wheelnut said:


> I commend you for your continued efforts!  Somebody will benefit from them, I'm sure!


..I decided to post this weeks (months?) back but have been otherwise occupied -> I just wanted to emphasize how much I commiserate with your frustration and discouragement.  I'm very familiar with the general feeling.  I encourage you all I can to maintain your efforts and keep up your good cheer!  Sounds like the world is, and will continue to become, a better place with you in it!


----------



## mikethe1wheelnut (Mar 24, 2022)

vermaden said:


> The limit of *FAT32* (known as msdosfs on FreeBSD) is* 4 GB*.
> 
> To omit that limitation *exFAT* was created.



This sounds like it should be very helpful.  For further clarity, you could identify the command to be used on bsd (seeing as you've said that FAT32 isn't called fat32 on bsd..).  I'm researching now how to do this..


----------



## mikethe1wheelnut (Mar 24, 2022)

Trihexagonal said:


> ```
> # mkdir -p /media/da0s1
> # mount -v -t msdosfs /dev/da0s1 /media/da0s1
> # umount -v -t msdosfs /dev/da0s1 /media/da0s1
> ...



..and the trek continues -> putting this here because it seems most appropriate.  I considered creating a new thread.  Trying, again, to unmount a usb-key.  Using the above method.


```
root@ozzie:~ # mount -v -t msdosfs /dev/da0s1 /media/da0s1
/dev/da0s1 on /media/da0s1 (msdosfs, local, writes: sync 1 async 0, reads: sync 1848 async 0, fsid 7a00000032000000)
root@ozzie:~ # umount -v -t msdosfs /dev/da0s1 /media/da0s1
/dev/da0s1: unmount from /media/da0s1
umount: /media/da0s1: not a file system root directory
root@ozzie:~ #
```

Anticipating being asked for it:

```
root@ozzie:~ # gpart show da0
=>       63  121110465  da0  MBR  (58G)
         63      60609       - free -  (30M)
      60672  121049856    1  fat32lba  (58G)
```


----------



## Alain De Vos (Mar 24, 2022)

```
gpart show -p
mount -t msdosfs try parameters -s and/or -o large.
```


----------



## mikethe1wheelnut (Mar 25, 2022)

Alain De Vos said:


> ```
> gpart show -p
> mount -t msdosfs try parameters -s and/or -o large.
> ```



for "-o" see what grahamperrin wrote above.  for gpart show -p :


```
root@ozzie:~ # gpart show -p
=>       63  250069617    ada0  MBR  (119G)
         63          1          - free -  (512B)
         64  249561088  ada0s1  freebsd  [active]  (119G)
  249561152     508528          - free -  (248M)

=>        0  249561088   ada0s1  BSD  (119G)
          0  241172480  ada0s1a  freebsd-ufs  (115G)
  241172480    8388608  ada0s1b  freebsd-swap  (4.0G)

=>       63  121110465    da0  MBR  (58G)
         63      60609         - free -  (30M)
      60672  121049856  da0s1  fat32lba  (58G)

=>       63  121110465    diskid/DISK-07009BCF0BB09B63  MBR  (58G)
         63      60609                                  - free -  (30M)
      60672  121049856  diskid/DISK-07009BCF0BB09B63s1  fat32lba  (58G)
```


```
root@ozzie:~ # mount -v -t -o msdosfs /dev/da0s1 /media/da0s1
usage: mount [-adflpruvw] [-F fstab] [-o options] [-t ufs | external_type]
       mount [-dfpruvw] special | node
       mount [-dfpruvw] [-o options] [-t ufs | external_type] special node
root@ozzie:~ # mount -v -t -s msdosfs /dev/da0s1 /media/da0s1
usage: mount [-adflpruvw] [-F fstab] [-o options] [-t ufs | external_type]
       mount [-dfpruvw] special | node
       mount [-dfpruvw] [-o options] [-t ufs | external_type] special node
root@ozzie:~ # mount -v -t -s -o msdosfs /dev/da0s1 /media/da0s1
mount: /dev/da0s1: Operation not supported by device
/dev/ada0s1a on / (ufs, local, journaled soft-updates, writes: sync 1569 async 18648, reads: sync 17188 async 688, fsid 59c85f6081eb028b)
```


----------



## grahamperrin@ (Mar 25, 2022)

Sorry, I lost track of things slightly above …

`fstyp /dev/da0s1`


----------



## mikethe1wheelnut (Mar 25, 2022)

grahamperrin said:


> Sorry, I lost track of things slightly above …
> 
> `fstyp /dev/da0s1`



huh.. so much for it being an unknown file-system.. the plot thickens..

```
root@ozzie:~ # fstyp /dev/da0s1
msdosfs
```


----------



## grahamperrin@ (Mar 25, 2022)

mikethe1wheelnut said:


> …
> 
> ```
> root@ozzie:~ # fstyp /dev/da0s1
> ...



`/sbin/fsck_msdosfs -n /dev/da0s1`


----------



## mikethe1wheelnut (Mar 25, 2022)

grahamperrin said:


> `/sbin/fsck_msdosfs -n /dev/da0s1`




```
root@ozzie:~ # /sbin/fsck_msdosfs -n /dev/da0s1
** /dev/da0s1
** Phase 1 - Read FAT and checking connectivity
** Phase 2 - Checking Directories
** Phase 3 - Checking for Lost Files
4 files, 52 GiB free (1701127 clusters)
```


----------



## mer (Mar 25, 2022)

mikethe1wheelnut said:


> umount -v -t msdosfs /dev/da0s1 /media/da0s1


Why all the parameters on umount?

It looks like that device mounts correctly, are you asking why it doesn't unmount correctly?
If gpart shows a partition that is a dos fs, when it gets plugged in you wind up with /dev/da0s1.  One
can also format the raw device so you only wind up with /dev/da0.
I have these lines in my /etc/fstab to make it a little simpler.
`/dev/da0s1              /flash  msdosfs rw,noauto               0       0
/dev/da0                /flash1 msdosfs rw,noauto               0       0`

Then as root I simply "mount /flash1" (or /flash depending on what ls -ltr /dev/da0* says), do what I need to, then
I do umount /flash1 to unmount it.

A quick "man umount" n shows that "-t" is for type to unmount, but it looks like your syntax is wrong based on man page.
If it mounts successfully, then try
umount /dev/da0s1
or
umount /media/da0s1
or if it is the only msdosfs mounted try
umount -t msdosfs


----------



## mikethe1wheelnut (Mar 25, 2022)

mer said:


> Why all the parameters on umount?
> 
> It looks like that device mounts correctly, are you asking why it doesn't unmount correctly?
> If gpart shows a partition that is a dos fs, when it gets plugged in you wind up with /dev/da0s1.  One
> ...




```
root@ozzie:~ # umount /dev/da0s1
umount: /dev/da0s1: unknown file system
root@ozzie:~ # umount /media/da0s1
umount: /media/da0s1: not a file system root directory
root@ozzie:~ # umount -t msdosfs
usage: umount [-fNnv] special ... | node ... | fsid ...
       umount -a | -A [-F fstab] [-fnv] [-h host] [-t type]
```


----------



## mer (Mar 26, 2022)

Ok, so that supports my statement "problem unmounting, not mounting", correct?
When you mount it, can you access the device, list contents, add files, delete files?  Note you may need to be root to do so.
After entering the mount command for da0s1, what does the command "mount" without any arguments show?  Does it 
actually show /dev/da0s1 mounted?
I know you show output of dmesg earlier, but to double check:
after the device is inserted, if you do "ls -ltr /dev/da*" is shows /dev/da0s1, yes?

Also, have you tried physically different devices?  If so, none of them work?


----------



## mikethe1wheelnut (Mar 26, 2022)

mer said:


> Ok, so that supports my statement "problem unmounting, not mounting", correct?
> When you mount it, can you access the device, list contents, add files, delete files?  Note you may need to be root to do so.
> After entering the mount command for da0s1, what does the command "mount" without any arguments show?  Does it
> actually show /dev/da0s1 mounted?
> ...




```
root@ozzie:~ # mount -t msdosfs /dev/da0s1 /media/da0s1
root@ozzie:~ # mount
/dev/ada0s1a on / (ufs, local, journaled soft-updates)
devfs on /dev (devfs, local, multilabel)
/dev/da0s1 on /media/da0s1 (msdosfs, local)
```


```
root@ozzie:~ # ls -ltr /dev/da*
crw-r-----  1 root  operator  0x7a Mar 24 14:51 /dev/da0s1
crw-r-----  1 root  operator  0x79 Mar 24 14:51 /dev/da0
```

I haven't tried on other devices.  The usb key is connected and ostensibly has files on it that I want it to have on it.  But if I remove it without it dismounted properly, they might vanish.  Yes, I could probably just unplug it, then if the files vanish, put them back on if no other solutions are suggested.  My attitude just now is more that of a curious detective than a desperate/frustrated person pulling their hair out   ..though that person is in there to.. ..hehe.. ;-)


----------



## mer (Mar 26, 2022)

mikethe1wheelnut said:


> My attitude just now is more that of a curious detective than a desperate/frustrated person pulling their hair out  ..though that person is in there to.. ..hehe.. ;-)


I'd have about 5 secs of hair pulling....

As for the files vanishing, etc.  If you haven't actually written anything to device in a while (5 minutes would be 100's of years) they shouldn't vanish.  Even after you unmount an USB device it may take a few secs (5 or so) to completely flush writes to the device.  I typically do the umount command then wait a minute or so after it completes.

If you have enough space on your hard drive, I would create a temp directory and then copy the files from usb to the hard drive.  That way you could actually verify the contents.

If the contents check out, then you don't need to worry about corrupting the USB device.

Just another couple questions:
you did a "mkdir /media/da0s1" at some point, yes?  I think I saw that on one of the previous pages, just don't want to look.
Are you running a desktop environment of any kind, with maybe a file manager?  Reason is sometimes they try to automount devices and
maybe causing issues.


----------



## grahamperrin@ (Mar 26, 2022)

mikethe1wheelnut said:


> *Problems mounting usb flash-drive*





mikethe1wheelnut said:


> ```
> root@ozzie:~ # mount -t msdosfs /dev/da0s1 /media/da0s1
> root@ozzie:~ # mount
> /dev/ada0s1a on / (ufs, local, journaled soft-updates)
> ...



So, mount(8) is no longer a problem.



mikethe1wheelnut said:


> … if I remove it without it dismounted properly, they might vanish. …



When you next mount, you can: 

`mount_msdosfs -o sync /dev/da0s1 /media/da0s1`

mount_msdosfs(8)

If `-o sync` is not specified at mount time, then you can `sync` at any time.

sync(8)


----------



## mikethe1wheelnut (Mar 26, 2022)

mer said:


> I'd have about 5 secs of hair pulling....
> 
> As for the files vanishing, etc.  If you haven't actually written anything to device in a while (5 minutes would be 100's of years) they shouldn't vanish.  Even after you unmount an USB device it may take a few secs (5 or so) to completely flush writes to the device.  I typically do the umount command then wait a minute or so after it completes.
> 
> ...


well, tried this.  created a new directory for files brought -back- from the usb.  it started copying fine, but it said it would take an hour, so I stopped it.  I figured it was obvious the files were there, no?  well, I went ahead and took out the usb.  plug it back in.. files gone.  this is checking it with thunar because.. why not?  it seems to be the default for freebsd.  ..I'm using the xfce desktop, because.. it worked.  I can still copy them back over again, but it'll probably take that hour all over again, and the biggest files weren't copied.  trying the solutions of others now..


----------



## Alexander88207 (Mar 26, 2022)

> mount: /media/usb: No such file or directory



BTW, i think that /media directory is something from ports. The typically /mnt directory exists by default.

So it (*can) be `mount -t msdosfs /dev/da0s1 /mnt`.

*It doesn't matter in the functionality where you mount it, only the directory have to exist.


----------



## mikethe1wheelnut (Mar 26, 2022)

mikethe1wheelnut said:


> well, tried this.  created a new directory for files brought -back- from the usb.  it started copying fine, but it said it would take an hour, so I stopped it.  I figured it was obvious the files were there, no?  well, I went ahead and took out the usb.  plug it back in.. files gone.  this is checking it with thunar because.. why not?  it seems to be the default for freebsd.  ..I'm using the xfce desktop, because.. it worked.  I can still copy them back over again, but it'll probably take that hour all over again, and the biggest files weren't copied.  trying the solutions of others now..


well, now I know why not to use thunar, or rather, to trust it.  I use the mount command suggested by grahamperrin, and lo and behold, the files appear!  (both in command line, -and- in thunar!)  -ok, will get back to this later..


----------



## mer (Mar 26, 2022)

mikethe1wheelnut 
Sometimes things like Thunar and other file managers do "automount" stuff.  Basically if you browse to the directory, they mount it, otherwise they don't.
That's why I have entries in /etc/fstab and have a term window open to do mount and umount commands.

fun stuff, eh?


----------



## grahamperrin@ (Mar 26, 2022)

mikethe1wheelnut said:


> … with thunar because.. why not? it seems to be the default for freebsd. …



Nope, it depends which desktop environment you choose.



Alexander88207 said:


> BTW, i think that /media directory is something from ports. …



As far as I know it's a standard part of FreeBSD, please see hier(7).


----------



## mikethe1wheelnut (Mar 26, 2022)

well, tried unmounting again, this time using -o ..


```
root@ozzie:~ # mount_msdosfs -o sync /dev/da0s1 /media/da0s1
root@ozzie:~ # umount_msdosfs -o sync /dev/da0s1 /media/da0s1
umount_msdosfs: Command not found.
root@ozzie:~ # umount
usage: umount [-fNnv] special ... | node ... | fsid ...
       umount -a | -A [-F fstab] [-fnv] [-h host] [-t type]
root@ozzie:~ # umount -o sync /dev/da0s1 /media/da0s1
umount: illegal option -- o
usage: umount [-fNnv] special ... | node ... | fsid ...
       umount -a | -A [-F fstab] [-fnv] [-h host] [-t type]
root@ozzie:~ # umount sync /dev/da0s1 /media/da0s1
umount: sync: statfs: No such file or directory
umount: sync: unknown file system
umount: unmount of /media/da0s1 failed: Device busy
umount: unmount of /media/da0s1 failed: Device busy
root@ozzie:~ # umount sync /dev/da0s1 /media/da0s1
umount: sync: statfs: No such file or directory
umount: sync: unknown file system
umount: unmount of /media/da0s1 failed: Device busy
umount: unmount of /media/da0s1 failed: Device busy
root@ozzie:~ # umount /dev/da0s1 /media/da0s1
umount: unmount of /media/da0s1 failed: Device busy
umount: unmount of /media/da0s1 failed: Device busy
root@ozzie:~ # umount  /media/da0s1
umount: unmount of /media/da0s1 failed: Device busy
root@ozzie:~ # umount /dev/da0s1 
umount: unmount of /media/da0s1 failed: Device busy
```
those last "Device busy" errors occurred after I closed thunar..


----------



## mikethe1wheelnut (Mar 26, 2022)

Alexander88207 said:


> BTW, i think that /media directory is something from ports. The typically /mnt directory exists by default.
> 
> So it (*can) be `mount -t msdosfs /dev/da0s1 /mnt`.
> 
> *It doesn't matter in the functionality where you mount it, only the directory have to exist.


well, this is encouraging:

```
root@ozzie:~ # mount -t msdosfs /dev/da0s1 /mnt
root@ozzie:~ # umount -t msdosfs /dev/da0s1
root@ozzie:~ #
```
..my understanding now is that to get the big file saved, I have to put an exFAT file system on the usb key..  (..I find this surprising, that freebsd can't save large files "by default" to such a key..)


----------



## grahamperrin@ (Mar 26, 2022)

mikethe1wheelnut said:


> … "Device busy" errors occurred after I closed thunar.



If there's no visible reason for prevention of unmount, try killing gvfsd-trash. It's not recommended, but re: <https://forums.freebsd.org/posts/545125> I sometimes choose to kill when it's troublesome with ZFS. (Troublesome also with some other types of file system? I don't know.)

Thunar​
A notification from Thunar to _not remove the media or disconnect the drive_ persists long after unmount by Thunar: 




– and so on:


----------



## mikethe1wheelnut (Apr 3, 2022)

vermaden said:


> The limit of *FAT32* (known as msdosfs on FreeBSD) is* 4 GB*.
> 
> To omit that limitation *exFAT* was created.



Could somebody please confirm that you can't format a usb-key with exFAT using FreeBSD?  I have searched and found nothing.  Seems you have to use either windows or linux, then install separate software on FreeBSD in order to read it.  Could be useful for future visitors to this thread to have this confirmed yay or nay.


----------



## grahamperrin@ (Apr 4, 2022)

mikethe1wheelnut said:


> Could somebody please confirm that you can't format a usb-key with exFAT using FreeBSD? …



Not so. 



grahamperrin said:


> I created an `ms-basic-data` partition on a hard disk drive, created an exFAT file system in the partition, used mount.exfat-fuse(8) to mount the file system, …



The screenshot there showed `mkexfatfs`.


```
% pkg provides mkexfatfs             
Name    : exfat-utils-1.3.0
Desc    : Utilities to create, check, label and dump exFAT filesystem
Repo    : FreeBSD
Filename: usr/local/sbin/mkexfatfs
usr/local/man/man8/mkexfatfs.8.gz
% pkg search -o exfat-utils
sysutils/exfat-utils           Utilities to create, check, label and dump exFAT filesystem
%
```

sysutils/exfat-utils


----------

