[plug] File system question

Denis Brown dsbrown at cyllene.uwa.edu.au
Tue Jan 22 11:47:50 WST 2002


Dear PLUG members,

I'd like to verify my thoughts on this file system issue concerning 
reclaiming disk space.  For the record it's a Debian system and the 
question is probably in the newbie-ish class but maybe others can benefit 
from the replies, too :-)

A two-disk system with several partitions on each disk.
On /dev/hdb2 I set up a Linux ext2 partition /FOO
On /dev/hda1 I have a directory foo under /
I decide to use the (larger) /FOO partition and so want to copy all files 
in /foo to /FOO and remove the original /foo directory.  I can do the copy 
using cp with the --recursive option to copy directories under /foo.  So 
far so good.
Now I edit (as root) fstab to mount /foo on /dev/hdb2, reboot and all seems 
okay.

My question is this:-
The space taken up by the files originally present in the /foo directory on 
hda1 are presumably "still there" but I cannot delete them because doing a 
rm * in foo now refers to my "new" foo which is on hdb2.  If the foregoing 
makes sense, is the space originally taken by foo's files on hda1 now 
automatically available for reuse or do I have to perform an additional 
operation to unlink the now redundant file space?

Doing a df before and after seems to suggest that the space is now up for 
grabs on hda1 but I'd like to confirm this before going too far along my 
current machine-rebuilding track.  I have rtfm'd but this does not seem to 
be given much weight.  The LDP's admin guides likewise don't seem to spend 
much time on it so maybe this is one of "the great understood things" 
(tm).  Some time ago on this list there was a discussion of such things but 
iirc that related to replacement of whole hard disks -- cloning -- as 
opposed to just moving around between partitions.

Supplementary questions:  In hindsight would it have been better to rename 
the original /foo directory to say /foo1, then copy the files to /FOO, then 
edit fstab and finally delete the /foo1 directory?  If a system area, such 
as /usr, were involved would the procedure require modification -- let's 
say that a second hard disk was being installed and /usr was desired to be 
on the new drive?  I imagine this requires fancier footwork because we'd be 
talking system files which may be actively in use.  Gut feeling suggests 
that your replies will refer to Tom's rtbt disk or another diskette/ramdisk 
approach to modifying the hard disk based fs's in this case.

TIA,
Denis



More information about the plug mailing list