Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a flash drive formatted as FAT32 with my data on it. I copied all my photos from it but realized that the permissions are totally garbled: the flags say "????????" and some of them even say "Permission Denied". Because there is no owner specified, I cannot run chmod.
How to fix this?
(and I am really considering to reformat the flash drive to a Linux filesystem now)
It does sound like the filesystem is damaged. By the way, you can't use chmod or chown for fat32, but you can for files you copied to a linux partition.
First eject the flash drive and then reinsert it. Maybe it will mount properly.
You can also attempt a repair.
I'd recommend using dd or ddrescue to create an image file of the flashdrive. Then run "/sbin/fsck.vfat <imagefile>" to try to repair it. You might want to create a copy of the image file and work on the copy. That way, if you cause damage to the file, you can delete it and make another copy.
If this doesn't work, you could use "testdisk" to try to recover files from the image.
FYI. For a vfat filesystem, you can use the fmask options when mounting the drive. This sets the permissions of all of the files on the (mounted) filesystem. You are correct that you loose linux ownership, groups & permissions when copying files to a fat32 filesystem. You can use tar to backup your pictures on a fat32 filesystem. Then when restoring them onto a Linux filesystem, you will restore the permissions as well.
If you still see question marks after formatting the flash drive, your drive is bad and should be replaced.
For a flash drive, you may want to mount it using the "noatime" option to reduce the number of writes.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.