Solved

Reclaiming disk space after unlinking dir

Posted on 1997-06-20
4
692 Views
Last Modified: 2013-12-27
I am running Solaris 2.5 using the GNU fileutils.  I was
id root (unfortunately) when I did a typo and did rm -rd
instead of rm -rf.  Now the directory is gone, but my disk
did not reclaim any more space.  I have done fsck several
times but it appears everything is fine.  Any ideas on how to reclaim the space besides remaking the fs and restoring?
0
Comment
Question by:bmccrary
  • 2
4 Comments
 
LVL 2

Expert Comment

by:mlev
ID: 2006443
The man page of rm suggests starting with fsck.
0
 
LVL 2

Expert Comment

by:mlev
ID: 2006444
Oops, sorry, didn't read carefully.

0
 
LVL 3

Accepted Solution

by:
dhm earned 100 total points
ID: 2006445
Did you try giving the "-o f" option to fsck?  Solaris-2.5 stores the filesystem state in the superblock, and if the state is "clean," fsck won't check.  The fsck man page says "-o f" forces fsck to check even if it thinks it doesn't need to.  (BTW, I always thought the option was simply "-f"; you might want to try that too, if "-o f" doesn't force the check.)

I'd expect the directory to end up in the lost+found directory at the top of the partition; the name will be the inode number that the directory had before you unlinked it.  BTW, it's possible that it's already there -- fsck won't "reclaim" space; it'll only find filesystem problems and repair them to the best of its ability.  This generally results in files and directories that have gotten halfway-deleted or otherwise lost, getting restored in the lost+found directory.
0
 

Author Comment

by:bmccrary
ID: 2006446
Thanks for your answer!  I had thought that fsck would ask me yes or no before it did anything to all of those files in the directory, but sure enough, there they all were in lost+found.  I feel really stupid now, but I don't normally go around unlinking directories! :)  Thanks!!!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question