[plug] File system question

Grahame Bowland grahame at ucs.uwa.edu.au
Tue Jan 22 12:47:32 WST 2002


On Tue, 2002-01-22 at 11:47, Denis Brown wrote:
> 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.

You'd probably do better to use cpio in pass-through mode than plain
'cp' - cpio handles things like wierd file names and symlinks better,
eg: cd /foo; find . -mount | cpio -pvm /FOO

> 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?

If you've mounted on top of an existing directory, the contents of that
directory are still on disk. If I'm ready it right, you want to do an
"umount /foo", make sure that worked and it's not mounted, then move
"foo" to "foo.O", "mkdir /foo", "mount /foo".

"foo.0" would then be the old "foo" before you moved it onto the new
partition.

-- 
Grahame Bowland                       Email: grahame at ucs.uwa.edu.au
University Communications Services    Phone: +61 8 9380 1175
The University of Western Australia     Fax: +61 8 9380 1109
                                     CRICOS: 00126G



More information about the plug mailing list