How To Get The Ownership Of Your Own USB Drive Back (On Linux)
So it happened that I gave away my USB drive to Vishal for a while, because I needed him to give me some of the awesome downloaded stuff that he has on his 250 Gb hard drive. He had a barely working Ubuntu installation on his PC which he was using to survive, because Windows XP had given up on his system after his graphic card died.
Anyway, I told him to remove the junk that has made a permanent place on my USB drive, and wipe it clean before he put in the new stuff. Sadly for me, Vishal is one of those guys who doesn’t use Shift+Delete, but uses Delete and then removes the stuff later on from the trash. A feature of Nautilus is that it doesn’t transfer your trash to the Trash folder, but instead transfers it to a folder called “.Trash-1000″ on the same partition.
Somehow, maybe because he forgot to unmount the drive before he pulled it out, the FAT filesystem on it got corrupted, and I lost control of my own drive. I could see all my old data inside the “.Trash-1000″ folder, but I couldn’t delete it. When I mounted it at my own place, it got mounted as a read-only medium, something like a CD drive. I couldn’t write to it, even as root.
As usual, I barged into the PCLinuxOS support forums. There, first I was told to do an fsck on the drive, which did not work, since it was a FAT filesystem. So I installed dosfstools first.
$ sudo apt-get install dosfstools
I then did a dosfsck on the drive, which returned a long list of errors.
Somebody told me that if I didn’t need the data on the drive, I should nuke it and start afresh. So I formatted the drive with the ext3 filesystem by using -
$ sudo mkfs.ext3 /dev/sdb1
Well the “.Trash-1000″ folder was apparently gone, but the drive was still getting mounted as read-only for me. This time it was a permissions issue, that is, I could write to it as root, but not as the normal user. To get ownership of the mount point temporarily, I did -
$ sudo chown apoorv /media/disk
But this was not satisfactory as I would have to do this everytime for every new USB drive I mounted. To gain permanent write access, a chmod was necessary.
$ sudo chmod +t /media/
And that was it. Now all USB drives will be mounted in write mode, irrespective of their filesystem.
If you liked this post, or found it useful, don't forget to subscribe to my RSS feeds. Or you can get my posts delivered to your inbox directly, by subscribing to my feeds by email. Or maybe you'd like to know what I'm doing right now, by following me at Twitter.

Leave a Comment