dd if=/dev/zero of=zero; rm -f zero

Discussion in 'Linux' started by Darryl, Jan 4, 2009.

  1. Darryl

    Darryl

    Joined:
    Sep 1, 2008
    Messages:
    308
    Likes Received:
    0
    I saw this on macles site and its used to fill empty drive space with zeros to enhance compression speed. Is there a way to reverse it and "unzero". I lost a gig before i twigged on (could have been worse) I dont really want to have to recover to get the space back.
    Thnx in advance :oops:
     
    Darryl, Jan 4, 2009
    #1
  2. Darryl

    lklaus

    Joined:
    Dec 20, 2008
    Messages:
    33
    Likes Received:
    0
    This is not supposed to anyhow hose your filesystem. How did you "lose a gig", just to understand you correctly?
     
    lklaus, Jan 4, 2009
    #2
  3. Darryl

    Darryl

    Joined:
    Sep 1, 2008
    Messages:
    308
    Likes Received:
    0
    had 5.6gig before the command and 4.4 when i killed it a few mins later...
     
    Darryl, Jan 4, 2009
    #3
  4. Darryl

    rbil

    Joined:
    Aug 14, 2008
    Messages:
    730
    Likes Received:
    0
    Location:
    The Wet Coast, Canada
    The commandline is actually executing 2 commands. First it is zeroing the deleted files by writing them to a file called "zero", then it is deleting the file "zero". If you killed the thing before it had a chance to remove "zero", that would account for the lost space. Just delete the file "zero", by running the second part of the command:

    rm -f zero

    Cheers.
     
    rbil, Jan 4, 2009
    #4
  5. Darryl

    Darryl

    Joined:
    Sep 1, 2008
    Messages:
    308
    Likes Received:
    0
    Sorted!
    The file was listed as 0 kb which meant i almost overlooked it, and i had to reboot but it came back. Ta very much :D
     
    Darryl, Jan 4, 2009
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.