Page 1 of 4 123 ... LastLast
Results 1 to 10 of 34

Thread: How To: Disk Full? - Check Your Trash

  1. #1
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    How To: Disk Full? - Check Your Trash

    Trash Problems and Solutions*

    * This guide was originally prepared under the title: Disk Full? - Check Your Trash Bin(s). I wrote a subsequent guide dealing specifically with lost 'free' space and how to restore it. That guide can be found at: Disk Space Problems & Solutions

    In a Rush and Sure It's a Trash Problem? Go Directly to #6 ...

    1. Error Messages - Why You Are Here?
    "There is not enough room on the disk to save ..." Perhaps you received an error message. Maybe you have tried but cannot delete the contents of the Trash bin. Perhaps you looked at your system files and realized that you were running out of disk space. Emptying the trash has been a tradition throughout the world since long before computers were invented. Over time we sometimes forget to do perform this important task.

    With computer trash, you have to not only remember to delete, you must know how to do it. If you cannot explain why you are running out of hard drive space, it may be because you haven't emptied the trash - properly, often enough, or perhaps both! Read on.

    2. Shrinking Free Space - Common Causes
    • Undeleted trash.
    • If you believe the cause of your problem is not a trash issue but your free space has unexpectedly decreased, please go to Disk Space Problems & Solutions.


    3. Checking Your Partition
    Here are some of the many ways to check your free space. Each has its advantages. Use the one or combination you like the best.
    • df -Th | sort (Terminal)
      Code:
      /dev/sda1     ext3     23G  9.6G   12G  46% /
      /dev/sda2     ext3     34G  2.1G   30G   7% /home
      /dev/sdg2  fuseblk    965M  5.4M  960M   1% /media/test
      Filesystem    Type    Size   Used   Avail   Use%   Mounted on
      Note: "sort" will order the partitions alphabetically. The "T" switch shows the file type - you can omit it if desired. If used, ntfs partitions will show type: "fuseblk".

    • Gnome-Device-Manager (GUI)
      System, Administration, System Monitor (gnome-system-manager)
      Code:
      Device      Dir     Type   Total     Free      Available   Used     %
      /dev/sda2   /home   ext3   33.1GiB   31.1GiB   29.4GiB     2.0GiB   6%
    • Disk Usage Analyzer / aka Baobab (GUI)
      Applications, Accessories, Disk Usage Analyzer.
      This is a graphical app that displays hard drives and partitions.
      While DUA is a valid tool, it often brings up questions about its use. Here are a couple of things to keep in mind:
      • One common question is why DUA seems to show twice as much space as the partition contains. By default DUA It displays the .gvfs (gnome virtual file system) folder contents. To get an accurate picture of the actual/physical contents, uncheck ".gvfs" via Edit, Preferences.
      • The top directory will always show 100% full. The percentages of all the folders adds up to 100%. It does not mean there is no space left on the drive/partition.


    • Find Large Files
      If you think you might have one or more large files taking up space, you can search for large files with the following commands. If you want to decrease the search file size, replace 'G' (gigabyte) with 'M' (MB). An initial installation will not have files larger than 500MB on the partition. Examples:
      Code:
      sudo find / -name '*' -size +1G
      sudo find / -name '*' -size +500M



    4. Trash Characteristics
    Under normal circumstances, only files/folders deleted with the terminal "rm" command or via the Shift-Del key combination in file browsers such as nautilus or thunar are immediately erased - freeing up disk space. The rest go to a trash bin, where deleted materials remain until the bin(s) are emptied.

    The Trash folders are hidden. If using the "ls" command in the command line, you must include the "-a" switch (ls -a). In nautilus or other file browsers, you must have "view hidden files" enabled (nautilus = Ctrl-H).

    There are two folders within the Trash bin - "info" and "files".
    • info: The "info" folder contains information regarding the files contained in the "files" folder. Each deleted file has an entry in the "info" folder, containing the deletion date and path.
    • files: This folder contains the actual deleted files.


    5. Why Must I Delete Trash?
    Until the trash bins are emptied, deleted items continue to take up disk space just as a normal files do. The space containing these deleted items cannot be used as long as the deleted files reside in Trash bin(s).

    If you want proof, find a suitably large file and make a copy of it. Using any of the methods above, review the free and used disk space and then delete the file via a file browser or right click/remove in a file browser. Recheck the results. You will notice the used and free space have not changed. The reason is because the deleted files in a Trash bin are still intact - they have only been moved to a different folder.

    6. Okay, Where Are the Trash Files?
    Here is where these files normally reside.

    • ~/.local/share/Trash User's Trash (hardy and later)
    • ~/.Trash User's Trash (pre-hardy)
    • /root/.local/share/Trash System Trash (hardy and later)
    • /root/.Trash System Trash (pre-hardy):
    • /.local/share/.Trash-1000 NTFS/FAT32/etc: Trash deleted in these partitions is placed in a Trash bin named in accordance with the user deleting the file, e.g. -1000, 1002, -0, etc

    In a file browser, typing "trash:/" in the location window will take you to the user's trash folder.

    All system trash, regardless of where it resides, by default contains the name "Trash". Here is a command that will greatly simplify your task. It seeks out all folders on your system that contain either "trash" or "Trash" while eliminating other files such as "trashapplet". It must be run with root privileges since it will be searching the system files. It does not require root privileges to be run on your home partition. It searches your entire system, so it may take a few minutes. Note: Since it finds any folder named Trash, it might find other non-system trash folders as well (such as an Evolution trash folder).

    Code:
    sudo find / -type d -name *Trash* 
    • Here is an example run on my computer:
      Code:
      ~/Desktop: sudo find / -type d -iname *Trash* | grep Trash
      /media/data/.Trash-1000
      ~/.local/share/Trash
      /home/.Trash-0
      /root/.local/share/Trash


    7. How Do I Delete Trash and Free Up Space?
    • The Safe Way: File Browser with Administrative Powers
      • gksudo nautilus (Terminal)
        • Do not use "sudo". Sudo is meant to be used for terminal commands and processes. This command, even though run in terminal, will open a gui application. "gksudo" is the appropriate command.
        • You can start nautilus with the folder path ( gksudo nautilus ~/.local/share/Trash ) It is necessary to navigate to each Trash folder to delete it's contents.
        • Note: If gksudo nautilus does not work, forum member SATXan reports in Post #31 that the following command might work: gksudo dbus-launch nautilus
        • Use Shft-Delete to delete individual folders/files. Confirm the "permanent delete" message. If you just hit the Delete key, the folders/files will be deleted and moved to the .... Trash/files folder! If you delete the parent Trash folder, this is not necessary. A simple press of the Delete key will remove the Trash folder and subfolders.
        • You may delete the entire Trash folder. It will be created the next time an item is deleted.
        • Nautilus also can delete trash directly, bypassing the Trash bin.
          • Edit > Preferences > Behavior tab > Trash
          • Include a right click option which allows a delete command which bypasses Trash


    • The Efficient Way: Command Line (with "chown" when required)
      • Using the Terminal. By using commands in terminal you can quickly delete all user-owned Trash folders. Using the command line combines ease of use with a bit of risk.

        You must ensure you have correctly input the command. Files deleted with the "rm" command are generally NOT recoverable!

      • To delete your Trash contents in your home folder:
        Code:
        rm -rf ~/.local/share/Trash/*
      • To delete root's Trash contents in your home folder:
        Sometimes root trash ends up in your local Trash bin. You cannot delete this without administrative powers. To accomplish the task, use "sudo" to change ownership of the Trash folder contents to the user, then delete the folder as above:
        Code:
        
        sudo chown -R username ~/.local/share/Trash
        rm -rf ~/.local/share/Trash/*
      • To delete root's Trash contents in root's Trash bin:
        I recommend using nautilus or another file browser, opened with root privileges, to accomplish this task. Using the command line to delete system Trash is safe only if the command is entered properly. A mistake could possibly erase system files and render the system unusable.

        There are commands which will directly delete root trash using "sudo rm -rf" but I will not reproduce them here. A safer method is again to change the ownership to yourself and then delete the Trash. Of course, if you enter the wrong commands twice you can still destroy your system...

        We will again use "sudo" to change ownership of the Trash folder contents to the user and then delete the folder as previously:

        Code:
        
        sudo chown -R yourusername /root/.local/share/Trash/
        rm -rf ~/.local/share/Trash


    8. How to Make Trash Bins on NTFS / VFAT Partitions
    A trash bin may automatically be created on NTFS and vfat partitions. It will be named by the UID of the user who deletes the trash - for example, .Trash-1000. Note that these are hidden folders (they begin with a . )

    If you wish to create a trash bin in a non-Linux partition:
    • In fstab, add "uid=<uid number>,gid=<gid number> to the partition options.
      Example for a user with the UID of 1000 on a partition mounted at /media/myfiles (Note you can check with the "id" command in a terminal):
      UUID=8797e97ew8790q87e907q /media/myfiles ntfs auto,users,umask=027,utf8,uid=1000,gid=1000 0 0
    • Create the trash folder in the specified partition. Example on a partition mounted as /media/myfiles:
      Code:
      mkdir /media/myfiles/.Trash-1000
    • Reboot or umount/mount the specified partition.



    9. A Few Tips About Trash
    • If your user Trash icon is not displayed on the Desktop, try this. Change the value to "false" to hide it.
      Code:
      gconftool-2 --type bool --set /apps/nautilus/desktop/trash_icon_visible "true"
    • If the .Trash-1000 (or user's uid if different) folder exists in ntfs/fat32 partitions the contents should be displayed in the user's Desktop Trash bin.




    Other Useful Trash-Related Links:
    HOWTO: Cleaning up all those unnecessary junk files
    DataRecovery
    HOWTO: Automatically regulate the size and age of your Trash folder
    A send-to-trash command for the shell.
    aa
    Last edited by drs305; January 13th, 2012 at 04:30 PM. Reason: gksudo dbus-launch nautilus
    New to Wayland.

    Retired.

  2. #2
    Join Date
    Aug 2007
    Location
    Manchester, UK
    Beans
    10,285
    Distro
    Ubuntu

    Re: How To: Disk Full? - Check Your Trash

    Moved to Tutorials & Tips.

    Nice how-to

  3. #3
    Join Date
    May 2008
    Location
    Beverley, UK
    Beans
    733
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: How To: Disk Full? - Check Your Trash

    A good How To. You need to alter the first location in section 6:

    /home/username/.share/local/Trash User's Trash (hardy and later)
    This should be changed to:

    /home/username/.local/share/Trash
    Alternatively, you may consider using "~/" when deleting file(s) in the home directory. This makes the command more portable and it can be copied and pasted. In some of the commands you posted, the user must enter their own username. This is not required.

    Other than that, good job
    Everything that has a Beginning, has an End

  4. #4
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: How To: Disk Full? - Check Your Trash

    Quote Originally Posted by WRDN View Post
    A good How To. You need to alter the first location in section 6:
    /home/username/.share/local/Trash User's Trash (hardy and later)

    This should be changed to:
    /home/username/.local/share/Trash


    Alternatively, you may consider using "~/" when deleting file(s) in the home directory. This makes the command more portable and it can be copied and pasted. In some of the commands you posted, the user must enter their own username. This is not required.

    Other than that, good job
    I hate dyslexia -- thanks.

    I debated how to designate the home folder, but since you bring it up here and new users can read that /home/username is equivalent to ~/ I've gone back and simplified things.



    Other Acknowledgements:

    Martje_001: Thank you for your input. I have added a note in Section 6.
    Last edited by drs305; August 29th, 2008 at 01:32 PM.
    New to Wayland.

    Retired.

  5. #5
    Join Date
    Feb 2007
    Location
    Nowhere important
    Beans
    1,198
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How To: Disk Full? - Check Your Trash

    It should be noted that #6 not always returns Trash folder. Like mine:
    Code:
    /home/martijn/Downloads/.Trash-1000
    /home/martijn/.local/share/Trash
    --> /home/martijn/.evolution/mail/imap/martijxxxx@xxxxx@imap.xxxx.com:993/folders/Trash <--
    /home/martijn/Documenten/.Trash-1000
    ➙ Synchronize all your files across Windows, Linux and Mac OS with Dropbox (2GB free storage!). By signing up via this link I'll get some extra space also, thanks!

    Multiseat on Ubuntu 10.04

  6. #6
    Join Date
    May 2007
    Location
    San Francisco, California
    Beans
    5,850
    Distro
    Ubuntu

    Re: How To: Disk Full? - Check Your Trash

    Nice, really smooth and well explained.

  7. #7
    Join Date
    Apr 2008
    Beans
    15
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: How To: Disk Full? - Check Your Trash

    Great how to and thanks!!

    Duke

  8. #8
    Join Date
    Jul 2006
    Location
    Hertfordshire
    Beans
    454
    Distro
    Kubuntu 9.04 Jaunty Jackalope

    Re: How To: Disk Full? - Check Your Trash

    Excellent HOWTO, very informative.

    Noticed a typo in section 5 ("Why Must I Delete Trash?"):

    "Reheck the results"

    Should be "Recheck"


    Thanks!

  9. #9
    Join Date
    Dec 2007
    Beans
    28
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How To: Disk Full? - Check Your Trash

    Thanks!! (I would thank you with the button, but it's gone )

    This helped me a lot:
    Quote Originally Posted by drs305 View Post
    • Check Your Log Files Take a look in /var/log and subfolders and see if an excessive number of small log files are being generated. You can run the following to see the size of each subfolder:
      Code:
      du -h /var/log
      If you find a particularly large log file and you don't want to delete it, you can remove its contents while keeping the file structure intact with the following command (hat tip to lensman3:
      Code:
      cp /dev/null /var/log/log_filename.log

  10. #10
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: How To: Disk Full? - Check Your Trash

    Quote Originally Posted by PeeZz View Post
    Thanks!! (I would thank you with the button, but it's gone ) This helped me a lot:
    I appreciate your note. Normally I read the responses but don't comment unless there is a question or I need to update the original post. But since you mentioned it, the 'thanks' button times out after so many days/months (I dont't know the number) and thus becomes unavailable.
    New to Wayland.

    Retired.

Page 1 of 4 123 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •