Shrinking the root dir (SYS5)

Brandon Allbery brandon at tdi2.UUCP
Sat Dec 13 03:39:50 AEST 1986


Quoted from <165 at uwslh.UUCP> ["Re: truncating root directory of a file system"], by dem at uwslh.UUCP (David E. Miran)...
+---------------
| In article <511 at cdx39.UUCP>, jc at cdx39.UUCP (John Chambers) writes:
| > Hey, here's a good puzzle for a Unix file-system wizard.
| > You know how some directories (like /usr/spool/uucp) can
| > get really huge... The usual solution is to rebuild
| > the directory - you rename it, create a new one in its
| > place, and moving the contents from the old one to the new.
| > 
| > Well, there's a case where this doesn't work too well. 
| > This is the root directory of a file system.
| There is a very straightforeward solution to this problem, which
| also cleans up other problems related to poor allocation of parts
| of the disk unit.
| 1.  Do a full save of the unit to tape.
| 2.  Unmount the unit.
| 3.  Recreate a file system on the unit using newfs or mkfs.
| 4.  Do a full restore of the unit from tape.
| 5.  Do a full save again since all the creation dates change.
| This is also a good time to check your average file size and perhaps
| recreate the unit with a larger number of bytes per inode.
+---------------

Under sys5 (no dump/restore), the best way is to find a spare disk partition
and dcopy the root partition.  This will also reorganize the directories for
fastest pathname searching (e.g. namei) and put the most commonly accessed
files in optimum places.

# dcopy /dev/rdsk/0s1 /dev/dsk/1s6
# dd if=/dev/rdsk/1s6 of=/dev/rdsk/0s1 bs=20b
# : note that you ought to boot off a different root to do the dd
# : unfortunately, Plexus is difficult to reboot for a different root!

You should have specified Sys3/Sys5/BSD4.x.

++Brandon
-- 
``for is he not of the Children of Luthien?  Never shall that line fail, though
the years may lengthen beyond count.''  --J. R. R. Tolkien

Brandon S. Allbery	           UUCP: cbatt!cwruecmp!ncoast!tdi2!brandon
Tridelta Industries, Inc.         CSNET: ncoast!allbery at Case
7350 Corporate Blvd.	       INTERNET: ncoast!allbery%Case.CSNET at relay.CS.NET
Mentor, Ohio 44060		  PHONE: +1 216 255 1080 (home) +1 216 974 9210



More information about the Comp.unix.wizards mailing list