Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: How to erase unused space on a hard drive?

  1. #1
    Join Date
    Jun 2008
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    How to erase unused space on a hard drive?

    I'm trying to figure out how to basically shred all the unused space on my hard drive, like what the "shred" command does to individual files.

    I know of a couple ways to do this for Windows, but none for Linux.

    Anybody point me in the right direction?

    Much appreciated!

  2. #2
    wojox is offline I Ubuntu, Therefore, I Am
    Join Date
    Apr 2009
    Beans
    8,628

    Re: How to erase unused space on a hard drive?

    Just found it last week, but haven't had a chance to try it fully yet

    Code:
    sudo apt-get install secure-delete
    http://www.techthrob.com/2009/03/02/...rely-in-linux/

  3. #3
    Join Date
    Jun 2008
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to erase unused space on a hard drive?

    Quote Originally Posted by wojox View Post
    Just found it last week, but haven't had a chance to try it fully yet

    Code:
    sudo apt-get install secure-delete
    http://www.techthrob.com/2009/03/02/...rely-in-linux/
    Thanks. Will try it now. Anybody know of any others?

  4. #4
    Join Date
    Sep 2008
    Beans
    519

    Re: How to erase unused space on a hard drive?

    I'm just posting because i'm curious..
    What do you mean by shredding unused space? .. like the unpartitioned space that shows up in gparted? or like... free space that hasn't been used yet? Then wouldn't you just have to download crap to fill it up?
    or just cat /dev/zero > file .. and that file'll grow until your harddrive's full

    but really, i just have no idea what you're talking about

  5. #5
    Join Date
    Jun 2008
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to erase unused space on a hard drive?

    Quote Originally Posted by renkinjutsu View Post
    I'm just posting because i'm curious..
    What do you mean by shredding unused space? .. like the unpartitioned space that shows up in gparted? or like... free space that hasn't been used yet? Then wouldn't you just have to download crap to fill it up?
    or just cat /dev/zero > file .. and that file'll grow until your harddrive's full

    but really, i just have no idea what you're talking about
    When you delete a file, it isn't really removed. The system just "forgets" about it. It's still there, written on the disk, until you download something else that overwrites it.

    Shredding overwrites all that previously used space with random garbage so that the files that used to be there can't be recovered (at least, it's much more difficult).

    The "shred" command is built in to the shell. Thus:

    Code:
    shred -vuzfn 50 file.name
    would overwrite the specified file with 50 passes of random garbage. Problem is, "shred" doesn't do unused space, only individual files.

    The link above is for a file called "Secure Delete", and it has commands to shred files as well as RAM and free space that has been used before, but isn't now (which is where deleted files live).

    Make sense? (Somebody correct me if I've gotten any of that wrong)

    *NOTE: So far so good with sfill. The site says that it's hard with journaling systems to get all the free space, but that there's no way around it. Most shredded is better than none shredded, I guess.... Thanks again for the link.
    Last edited by solwic; October 3rd, 2009 at 02:28 AM.

  6. #6
    Join Date
    Feb 2008
    Beans
    794
    Distro
    Ubuntu

    Re: How to erase unused space on a hard drive?

    best way to "wipe" empty space is to use the "dd" command..

    Code:
    sudo dd if=/dev/zero of=/home/[your username]/wipe.file
    once it's finished run
    Code:
    rm /home/[your username]/wipe.file
    The first command basically create a file called "wipe.file" and keep filling it with zero's till the disk is full.
    You could use /dev/urandom instead which will fill the file with random data.
    if you don't use sudo then all but 5% of the will be used (5% is reseved for the root login)

    it might take a while depending on how big your drive is...
    Laters...
    Sol
    "Have you found the secrets of the universe? Asked Zebade "I'm sure I left them here somewhere" User numbers: Ubuntu 23772 Linux 477911

  7. #7
    Join Date
    Jun 2008
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to erase unused space on a hard drive?

    Quote Originally Posted by solitaire View Post
    best way to "wipe" empty space is to use the "dd" command..

    Code:
    sudo dd if=/dev/zero of=/home/[your username]/wipe.file
    once it's finished run
    Code:
    rm /home/[your username]/wipe.file
    The first command basically create a file called "wipe.file" and keep filling it with zero's till the disk is full.
    You could use /dev/urandom instead which will fill the file with random data.
    if you don't use sudo then all but 5% of the will be used (5% is reseved for the root login)

    it might take a while depending on how big your drive is...
    Which essentially does what secure delete and shred do: fill your drive with garbage, then wipe the garbage out.

    Good idea. Might experiment with it, research it a little.

  8. #8
    Join Date
    Sep 2008
    Beans
    519

    Re: How to erase unused space on a hard drive?

    heey! i offered the same advice without even knowing what the OP wanted!

    anyway.. if the data is still stored on the HD, is there a builtin shell command to UNdelete a file also?

  9. #9
    Join Date
    Jun 2008
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to erase unused space on a hard drive?

    Quote Originally Posted by renkinjutsu View Post
    heey! i offered the same advice without even knowing what the OP wanted!

    anyway.. if the data is still stored on the HD, is there a builtin shell command to UNdelete a file also?
    Not that I'm aware of. The only way to undelete that I've found is complicated and involves two or three programs. Must have something to do with the journaling filesystems, because there's a freeware Windows program that works wonderfully on NTFS drives.

  10. #10
    Join Date
    Feb 2008
    Location
    USA
    Beans
    86

    Re: How to erase unused space on a hard drive?

    Quote Originally Posted by iRun View Post
    Thanks. Will try it now. Anybody know of any others?
    Since version 0.6.1 BleachBit erases unused hard dive space.

    Quote Originally Posted by solitaire View Post
    best way to "wipe" empty space is to use the "dd" command..
    Except that doesn't wipe the inodes (file metadata such as file names). BleachBit wipes the inodes too.

Page 1 of 2 12 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
  •