# Cannot access USB drive



## walterbyrd (Dec 2, 2015)

I am trying to use FreeBSD as my main desktop. I previously used Debian Linux. 

I have FreeBSD 10.2 AMD 64-bit installed. 

What I did


```
# pkg search ntfs

fusefs-ntfs-2015.3.14_2        Mount NTFS partitions (read/write) and disk images
ntfsprogs-2.0.0_5              Utilities and library to manipulate NTFS partitions
```

I installed both.

Then put 
	
	



```
fuse_load="YES"
```
 into /boot/loader.conf and rebooted.

then:


```
# dmesg | grep -i da

da4 at umass-sim1 bus 1 scbus7 target 0 lun 0
da4: <Seagate Portable 0130> Fixed Direct Access SPC-2 SCSI device
da4: Serial Number 2GH2YSV5    
da4: 40.000MB/s transfers
da4: 610480MB (1250263728 512 byte sectors: 255H 63S/T 77825C)
da4: quirks=0x2<NO_6_BYTE>
```

That looks like my drive

When I plug in the drive, my system can see the drive, but I get the error message:


```
Uable to mount ext_hdd. 
An operation is already pending.
```


I try to mount manually


```
# mkdir /mnt/usb
# ntfs-3g /dev/da4 /mnt/usb

NTFS signature is missing.
Failed to mount '/dev/da4': Invalid argument
The device '/dev/da4' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
```

I plugged the drive into my windows laptop, to make it is NTFS. I right clicked on the drive, when to properties. Sure enough, it is NTFS. 

Any ideas?

(btw: it is a bit surprising that such a common operation would be so difficult)


----------



## tobik@ (Dec 2, 2015)

What's the output of `gpart show da4`? You most likely have to use a partition like /dev/da4s1 or /dev/da4p1 and not the whole drive.


----------



## walterbyrd (Dec 2, 2015)

```
# gpart show da4
=>        63  1250263665  da4  MBR  (596G)
              63  1250258625    1  ntfs  [active]  (596G)
  1250258688        5040       - free -  (2.5M)

# ntfs-3g /dev/da4s1 /mnt/usb
The disk contains an unclean file system (0, 0).
The file system wasn't safely closed on Windows. Fixing.

# ntfs-3g /dev/da4s1 /mnt/usb
```

The second time I ran `# ntfs-3g /dev/da4s1 /mnt/usb` I did not get an error at the command line.

I am now able to access the drive from the command line. Thank you.

However, when I try to access from MATE, I still get the error: "Operation pending. Cannot mount."

At the command line, I am logged in as root. In MATE I am logged in with my user account. I set permissions to to /mnt/usb to 777, but still cannot access it from the GUI.

At the command line, I exited su, back to my user account. Tried to mount:


```
$ ntfs-3g /dev/da4s1 /mnt/usb
Error opening '/dev/da4s1': Permission denied
Failed to mount '/dev/da4s1': Permission denied
Please check '/dev/da4s1' and the ntfs-3g binary permissions,
and the mounting user ID. More explanation is provided at
http://tuxera.com/community/ntfs-3g-faq/#unprivileged
```

I will read up. And see if that helps.

Nope. The advice at that link did not help. 

I was advised to `chmod 4755 $(which ntfs-3g)` but that did not work. 


```
# chmod 4755 $(which ntfs-3g)
chmod: /usr/local/bin/ntfs-3g: Operation not permitted
```

So I tried: 


```
# chmod 4755 /usr/local/bin/ntfs-3g
# exit
$ ntfs-3g /dev/da4s1 /mnt/usb
Mount is denied because setuid and setgid root ntfs-3g is insecure with the
external FUSE library. Either remove the setuid/setgid bit from the binary
or rebuild NTFS-3G with integrated FUSE support and make it setuid root.
Please see more information at
http://tuxera.com/community/ntfs-3g-faq/#unprivileged
```


----------



## Phishfry (Dec 4, 2015)

If you can deal with FAT limitations I think you would find `mount_msdosfs` works very well for removable storage.


----------



## Phishfry (Dec 4, 2015)

So in case I was not clear. Stick your USB drive into your Windows computer and format your USB drive as FAT32
(4GB file limitation) Then you can mount in FreeBSD with `mount_msdosfs` with a command like this:

```
mount_msdosfs /dev/da4s1 /mnt/usb
```
If you plan on sharing configuration files between Windows and FreeBSD beware of the CF/LF problems. It has bitten me more than once.
Save all files with an Windows alternative text editor like Notepad++ for proper file formatting (use UNIX file type when saving).


----------



## wblock@ (Dec 5, 2015)

Use mount(8), not the individual mounting programs.  For MS-DOS, that is `mount -t msdosfs /dev/da4s1 /mnt/usb`.


----------



## walterbyrd (Dec 5, 2015)

I am trying to copy files from my USB drive, to my FreeBSD desktop. 

I am moving from Debian, and giving FreeBSD a try. 

I backed up my files on my USB drive, then formatted the drive, and installed FreeBSD.

Anyway, I don't want to format my USB drive while it still has my data on it. 

Besides, NTFS is very commonly used. I don't want to be restricted about which thumb drives I can use. 

It is really that difficult to read a NTFS drive from FreeBSD?


----------



## shepper (Dec 5, 2015)

If you are just reading NTFS files you do not need the extra fusefs layer - you can mount directly.
`# mount -t ntfs /dev/da4s1 /mnt/usb`
or
`# mount_ntfs /dev/da4s1 /mnt/usb`

More here


----------



## tobik@ (Dec 5, 2015)

shepper said:


> If you are just reading NTFS files you do not need the extra fusfs layer - you can mount directly.


`mount_ntfs` is gone since FreeBSD 10.0.



walterbyrd said:


> I am now able to access the drive from the command line. Thank you.
> 
> However, when I try to access from MATE, I still get the error: "Operation pending. Cannot mount."


Don't go over the drive icon. That's another problem. Go directly to /mnt/usb. You may need to mount the file system with `ntfs-3g -o uid=<your user id> /dev/da4s1 /mnt/usb` (as root) to make files readable by your user.

You may want to setup vermaden's automounter instead of fixing MATE: sysutils/automount and Thread devd-based-automounter.29895


----------



## wblock@ (Dec 5, 2015)

The new autofs(5) has been in the system since 10.1.


----------



## Phishfry (Dec 5, 2015)

What version of Windows did you format the thumbdrive with? Every version of Windows seems add new features to NTFS.

Last thumbdrive I bought was factory formatted FAT32.. Format another thumbdrive FAT32 and copy over your files....Done complete with all those nasty Alternative Data Streams GONE...

http://www.windowsecurity.com/articles-tutorials/windows_os_security/Alternate_Data_Streams.html


----------



## Phishfry (Dec 6, 2015)

Sorry to be such a jerk about NTFS. I spend a lot of my free time helping de-slime Windows boxes for my friends... I see thumb drives as an easy way to spread malicious software and they must be treated specially -especially with NTFS. Now if you have 4.7 GB ISO files you want to carry over -that does not do you any good with FAT32 4 GB file limitation..
And I am not claiming that the MBR of FAT can't be infected, its just that lots of infectors attack 'My Documents' file attributes and those files copied over carry ADS attributes. Good or Bad.
http://www.cknow.com/cms/vtutor/ntfs-ads-viruses.html


----------



## walterbyrd (Dec 11, 2015)

Thank you for reply.


`# mount -t ntfs /dev/da4s1 /mnt/usb`

Gave me the error: 
	
	



```
mount: /dev/da4s1: Operation not supported by device
```

`# mount_ntfs /dev/da4s1 /mnt.usb`

Gave me the error: 
	
	



```
mount_ntfs: Command not found.
```


----------



## walterbyrd (Dec 11, 2015)

Thank you.

`ntfs-3g -o uid=<your user id> /dev/da4s1 /mnt/usb`

Works from command line.

Using MATE:

Does not work if I go to "Places" and then the drive.

However, if I go to Applications -> System Tools -> Caja

It does seem to work.

Thanks again.


----------



## walterbyrd (Dec 28, 2015)

I thought this was working, but it's not. 

My ntfs mount is very unstable. I get constant input/output errors, and the drive randomly unmounts itself.

This is seriously disappointing, and may affect my decision to use FreeBSD instead of Linux.


----------



## Handy92 (Dec 28, 2015)

> This is seriously disappointing, and may affect my decision to use FreeBSD instead of Linux.



So... use Linux, (or hackintosh) fix it, or pay someone who can fix it. I have actually Linux at second system and shared folder.


----------

