Solved

Reclaiming disk space after unlinking dir

Posted on 1997-06-20
4
685 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
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.

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now