Fix USB key sticks that wrongly report theyre full

Have you ever tried to copy files to a USB key stick (or other removable storage device, such as a memory card), and received an error message to say that the disk is full even though the total filesize of the files is nowhere near the USB key stick's limit? The probable cause is the invisible .Trash folder that Nautilus creates on a USB key stick each time you delete something on it. This fills up with old files each time you delete something on the USB stick.

The quickest solution is just to unmount the USB stick by right-clicking it and selecting Unmount Volume. You should then be prompted if you want to empty the trash on the device. Click the Empty Deleted Items button, and then pull the USB stick out of your computer and reinsert it again to remount it.

If this doesn't work, or if you don't see the prompt asking if you want to empty the trash, you can delete the hidden trash folder using a handful of terminal commands. Start by reinserting the USB stick so it's mounted again. USB key sticks are usually mounted in the /media folder, in a folder named after their label. For example, the USB key stick on my test computer is called KINGSTON, so I opened a terminal window and issued the following command to change into the relevant folder: cd /media/KINGSTON.

Use the ls -a command to reveal hidden files, then use the rm -rf to remove any file called .Trash, or a variation of this. On my test system the folder was called .Trash-1000, so I typed the following to delete it:

In actual fact, assuming you're using the USB stick simply to store files, it might be wise to delete all other hidden files (those with a period in front of them). Ubuntu isn't alone in saving hidden files to the disk for the purposes of trash (and more)—Macintosh OS X does too.

To stop the disk from getting full in this way in future, follow Tip 228, on page 269, which describes how to add a Delete entry to the right-click menu that bypasses the Trash facility. Unfortunately, at the present time, it is not possible to disable Ubuntu's Trash function.

Was this article helpful?

0 0

Post a comment