Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Regain lost space hidden in trash on external disks System
Think you emptied the trash on your external drive? Even if you did, there may be large amounts of trash still lurking on external or network drives that has not been emptied. As most folks know, the trash is segregated by user ID, and when you empty the trash, it only empties your user's trash -- even on FireWire disks.

If you delete a user's account on your computer, the system won't remove the trash for that user ID on the external or network drive. This can also happen if you have ever shared a disk between two computers. Since the UIDs on one computer may not be the same as the other, trashes can be created by one computer that cannot be emptied by the other. This can even happen if your username is the same on both computers, but your UIDs (e.g. 501 an 502) are different.

Thus periodically one needs to manually remove the trash like this, in Terminal:
$ sudo -s
$ rm -rf /Volumes/"my_external_disk"/.Trashes/*
$ exit
Replace "my_external_disk" is the name of the disk from which you want to remove all trash from all users. (The quotes are used in case of spaces in the disk name.) I noticed this because I had lost about one-third of my disk space to this phenomena, even though I only had one user account on my present computer.

[robg adds: Be very careful with the rm -rf command -- one little typo could be devastating. To make sure you're deleting the right files first, consider running it with the -i option, which will ask you to confirm each file deletion before it happens.]
    •    
  • Currently 2.63 / 5
  You rated: 3 / 5 (8 votes cast)
 
[16,558 views]  

Regain lost space hidden in trash on external disks | 4 comments | Create New Account
Click here to return to the 'Regain lost space hidden in trash on external disks' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Regain lost space hidden in trash on external disks
Authored by: lithoman on Jul 03, '08 09:07:43AM

replace exit with sudo -k
otherwise any command someone types prefaced with sudo will execute as root without asking for a password. This happens even if you close the terminal window and make a new one.



[ Reply to This | # ]
Regain lost space hidden in trash on external disks
Authored by: djdawson on Jul 03, '08 09:44:15AM

You can also edit your /etc/sudoers file and add this line to turn off the sudo grace period:

Defaults:ALL timestamp_timeout=0

You'll need to use the "sudo visudo" command to do this. There are a few other things you can do to tighten down the sudo command, such as enabling logging and restricting which users can use it, so interested users may find it useful to also do a "man sudoers" and read about the various options.



[ Reply to This | # ]
Regain lost space hidden in trash on external disks
Authored by: corienti on Jul 03, '08 04:06:17PM

... for 5 minutes since you originally entered the password, until sudo forgets the password.

Or, alternately, you could just be not paranoid about someone maliciously running a sudo command on your computer within the next 5 minutes while you're distracted somehow, not noticing a stranger on your keyboard and in a terminal in time to prevent them carrying out their evil plan... :-)

(whereby they need root access to accomplish their nefarious activities, and for some reason simply deleting your documents isn't sufficiently evil)

sudo -k is worth pointing out, for sure - it's good for people to know about - but your post sounds unnecessarily alarmist, to me :-)



[ Reply to This | # ]
Regain lost space hidden in trash on external disks
Authored by: mrrsoftware on Jul 03, '08 09:08:50AM
For those who would rather not venture to the command line, try out 'Curb' by MRRSoftware. It provides a number of ways to empty the trash and regain your lost space from mounted volumes such as USB Keys.

http://web.mac.com/mickeyroberson/MRR_Software/Curb.html




[ Reply to This | # ]