Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!rutgers!clyde!cuae2!ihnp4!cbatt!cwruecmp!hal!ncoast!tdi2!brandon
From: brandon@tdi2.UUCP (Brandon Allbery)
Newsgroups: comp.unix.wizards
Subject: Shrinking the root dir (SYS5)
Message-ID: <120@tdi2.UUCP>
Date: Fri, 12-Dec-86 12:39:50 EST
Article-I.D.: tdi2.120
Posted: Fri Dec 12 12:39:50 1986
Date-Received: Tue, 16-Dec-86 02:36:45 EST
References: <511@cdx39.UUCP> <2302@mtgzy.UUCP> <165@uwslh.UUCP>
Reply-To: brandon@tdi2.UUCP (Brandon Allbery)
Followup-To: comp.unix.wizards
Organization: Tridelta Industries, Inc., Mentor, OH
Lines: 44

Quoted from <165@uwslh.UUCP> ["Re: truncating root directory of a file system"], by dem@uwslh.UUCP (David E. Miran)...
+---------------
| In article <511@cdx39.UUCP>, jc@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@Case
7350 Corporate Blvd.	       INTERNET: ncoast!allbery%Case.CSNET@relay.CS.NET
Mentor, Ohio 44060		  PHONE: +1 216 255 1080 (home) +1 216 974 9210