We help IT Professionals succeed at work.

How to set permissions for a mounted usb drive?

thummper
thummper asked
on
2,248 Views
Last Modified: 2013-12-15
Hi I have a usb external HD which is mounted as /media/My Passport, and I cant set permissions on it. The only user I found which can write to it is root, and it fails on shell move command (as root even). When I look at it it says "permissions cannot be determined" and wont let me set them. When I try to move files to it as root using:

mv  /path/1.pdf   /media/My?Passport/pdfs/1.pdf'

i get:

mv: failed to preserve ownership for `/media/My Passport/pdfs/1.pdf': Operation not permitted

Anyone know how to set permissions on this thing?
Comment
Watch Question

Commented:
Is it mounted read-only?

Is it perhaps formatted with a filesystem type that can only be mounted read-only on Linux, like NTFS? If you brought the drive over from a Windows system, that is very likely.

There is a user-space NTFS driver that does write access; I don't really know how to use it myself, but you can take a look here for information.

http://www.linux-ntfs.org/doku.php
Software Developer
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Well, Im kind of clueless with this stuff at this point, not sure what file system it has or what fstab is. Its not a memory stick, its a usb drive, Passport from WD, completely stock and never been plugged into a windows box. Mount is whatever it gave manually, but I can remount it if needed. I can drag and drop files onto it just fine, but when I use "mv" it gives me crap. Also note that drag and drop only worked when logged in as root.

With the solution given by duncan_roe, do I type that in fstab then unmount and remount?

If it helps, the files Im trying to move onto it are ones downloaded and saved into the apache/htdocs folder, and theres about 400,000 of them in a couple sub folders, which is why I want to do it command line.
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Duncan RoeSoftware Developer
CERTIFIED EXPERT

Commented:
You can find out what the file system type is by typing "mount" when the drive is mounted. E.g. on my system for the USB stick I get:

/dev/sdb1 on /sdb1 type vfat (rw,noexec,nosuid,nodev,umask=0)

Whatever comes after "type", that's the file system type. Rot can write so it's writable, we just have to figure out how to get permissions. If it's vfat, modify /etc/fstab as I said then unmount / remount as you said should do the trick. Post if problems persist (mention what file system type it is)
Duncan RoeSoftware Developer
CERTIFIED EXPERT

Commented:
USB devices are intended to be transportable - hence lowest common denominator of VFAT.

Author

Commented:
OK, says filesystem type msdos. I added the line to fstab but still cant set permissions. May not be an issue though cause I noticed that the shell mv command actually did move the files even though it gave an error, it just put up the error that it couldnt maintain file permissions of the copied files. Thats actually OK cause the files are being transported to a windows box later.  The problem is, though , that after copying files to the drive it gave the error that the target disk is full. its not. So, I tried putting into a different folder, same result. copied files, then said disk full. Total, though, the disk is only 17% full. Is there some kind of limit via the msdos filesystem doing this?
Duncan RoeSoftware Developer
CERTIFIED EXPERT

Commented:
It may be that the operation you are attempting does indeed fill the disk, and mv deletes the file again before reporting the error. Otherwise msdos file system will have 2G limit. Actually the limit might be lower because msdos file system is the old one for 16-bit DOS.  Modern Linux mkmsdosfs will actually make VFAT so you might want to try re-making the file system on your USB drive.
Add "-v" option to your mv command to see better what is going on.
Duncan RoeSoftware Developer
CERTIFIED EXPERT

Commented:
Oops command is mkdosfs, not mkmsdosfs
Duncan RoeSoftware Developer
CERTIFIED EXPERT

Commented:
According to the man page you must still give mkdosfs the "-F 32" option to make VFAT, but that has not been my experience

Author

Commented:
ok, few more specifics. When it "fills" a folder it puts a max of 19,500 (give or take about 100) files in, which adds up to about 3.8GB (thats all per folder), then considers the disk full. The disk is 250MB and only 17% full, each file is roughly 200k, so its not trying to put a file thats too big for the remainder on. Im moving files off atm so I can try the mkdosfs command safely. Seems like mkdosfs would mean "make dos files system", but it already is msdos. Did I miss something? also, is vfat readable by windows when I move the files over? And thanks for all your help.

Author

Commented:
Thanks for all your help. Still having the issue, but I think it has forked into a significantly different question, and we have permissions situated. So, Im closing this one out and starting a new thread. Id you would be kind enough, please drop in at

https://www.experts-exchange.com/Storage/Removable_Backup_Media/Q_23636052.html

and see if we can finish out the discussion, feels like were close.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.