*BSD News Article 26441


Return to BSD News archive

Newsgroups: comp.os.386bsd.questions
Path: sserve!newshost.anu.edu.au!munnari.oz.au!bunyip.cc.uq.oz.au!harbinger.cc.monash.edu.au!yeshua.marcam.com!news.kei.com!sol.ctr.columbia.edu!destroyer!nntp.cs.ubc.ca!newsserver.sfu.ca!sfu.ca!vanepp
From: vanepp@fraser.sfu.ca (Peter Van Epp)
Subject: Re: Wish to change the size of mount /usr
Message-ID: <vanepp.759364330@sfu.ca>
Sender: news@sfu.ca (seymour news)
Organization: Simon Fraser University, Burnaby, B.C., Canada
References: <2humo9$701@icicle.winternet.mpls.mn.us>
Date: Sun, 23 Jan 1994 22:32:10 GMT
Lines: 74

bmcgrail@winternet.mpls.mn.us (Ben McGrail) writes:

>Hello all...
>I currently have the mounts of...

>Filesystem  1K-blocks    Used   Avail Capacity  Mounted on

>/dev/wd0a       14591    8151    4980    62%    /

>/dev/wd0e      427407   64822  319844    17%    /usr

>/dev/wd0h       10528    3552    6976    34%    /msdos

>on my system.

>What I wish to do is shrink the size of /usr and remount 1 to 200 megs under a 
>differant directory.

>Does anyone know of a way to do this?  and if so, would you please reply here or s
>send me email!
>   
>---
>thanks
>bmcgrail@winternet.mpls.mn.us

First back up all of /usr/ to floppy or tape using tar, cpio or dump (cpio
or tar are probably your best bets). Then build a boot floppy and a file
system floppy from the distribution set. Mount the file system floppy on
/mnt, and erase install and anything else that you don't need. You will
need all of the following things that aren't in /bin or /sbin (since all
of /usr/ will be gone): newfs, disklabeli fsck, cpio or tar or restore 
(depending on your choice of backup stuff), possibly vi (which implies 
/usr/share/something/termcap, do an ls -l on /etc/termcap, and whereever it 
points you need!).  
	The idea is that you are going to boot the boot floppy and when it asks,
insert your modified file system floppy (edit its .profile and remove the
line "install" so it doesn't try and do the install). This should give you a 
# prompt in single user mode without the harddisk mounted. Mount the 
harddisk root file system on /mnt (mount -r /dev/wd0a /mnt). Adding /mnt/bin 
and /mnt/sbin to your path may save a little hassle, otherwise you need
to specify the patch (/mnt/sbin/fsck for instance). Try using vi and 
disklabel (to read the label only to start with!). If you find you are
missing something mount -r /dev/wd0e /mnt/usr will get you the /usr file 
system on /mnt/usr where the missing stuff can be copied to / on the 
fs floppy. Starting update (update at the prompt) to keep syncing the 
floppy is a good bet. Once the file system floppy is set up, then the
fun starts: you are going to use disklabel to relabel the hard drive and
change partition "e" (/usr) to being 200 megs smaller. You are then going
to add a new partition "f" (remembering to bump the partition count up
by one in the label) that contains the new space you want taken from 
partition "e" (calculating the cylinders carefully for your self).
You then need to relabel the disk so the new partitions exist, and then
newfs them both (reading the install shell script and/or the man pages
will give you a feel for how to do this). Now mount /dev/wd0e /mnt/usr
(this being the new smaller /usr) and use tar, cpio or dump to restore
the usr files to this partition. Enter halt and remove the floppy, reboot
and pray, if all went well the system will boot from the hard drive and 
your new smaller /usr will be mounted. At this point you need to create
a mount point for the new partition (/usr/local for instance), create an
entry for it in /etc/fstab, and mount it (or reboot after adding it to 
/etc/fstab), and away you go.
	Note that this is a broad outline of what you need to do not an
exact step by step procedure, I have glossed over some of the steps
(due to lazieness :-) ), and it is possible for you to destroy your whole
system (including DOS) by making a mistake. Make sure that you have a 
good backup of everything, and read the man pages for all steps (and/or
look and see what the install script does) before proceeding.
	Good luck!

Peter Van Epp / Operations and Technical Support 
Simon Fraser University, Burnaby, B.C. Canada