RutSum

June 10th, 2008

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, by looking at my Jaiku badge. But I don't think you would be dumb enough to waste your time and have a look at what randomness I post on Twitter.




Leave a Comment

Tags: , , , ,

This entry was posted on Tuesday, June 10th, 2008 at 1:00 am and is filed under Open Source Is My Life. You can follow any responses to this entry through the RSS 2.0 feed.

People who read this post also read :

Seagate FreeAgent Desktop Makes Your Life More Difficult Than Easier

When I bought my Altec Lansing AHP524 Studio Headphones recently from Nehru Place I also bought a Seagate FreeAgent Desktop

PCLinuxOS 2007

I've finally found the distro that meets my daily needs, and qualifies for becoming a mainstream distro, a replacement to

Jazz Jackrabbit 2 on Linux

This came as a pleasant surprise. This is where Linux beats Windows hands down. Wine can be used to run

How To Make Your Audio Fly Around Your House, Wirelessly – Airfoil

Well this has been a problem since the day I got a MacBook – how to enjoy audio output on

Peroo, Monomoboshik and Flickr - You Don’t Want To Miss The Action

This last week, Uncool, Kitallis and me, we spent at Kitallis’ place mostly wasting time, and spending about 5% of