Well, I've managed to combine my /usr (sd0g) and /home (sd0h)
partitions and the system is alive and well. It was quite simple in the
end (well, it should have been :-) - see below). This is what I did
(and didn't) do.
To start with I had said nothing about what resources I had
available, which is probably just as well as it allowed everyone to
assume what they wanted.
While combining /home and /usr their contents will be unavailable,
so I have to find a way of having the relevant commands around. The
winning suggestion for this was:
> 2) Find some way to get a /usr directory mounted. The easiest way
> is to export /usr from another machine and mount it as /usr.
first suggested by: macphed@dvinci.usask.ca (Ian MacPhedran)
In fact, I basically ended up using his entire suggestion, so I
might as well include it all here.
> When you combine the partitions, you will lose the data on both partitions.
> I.e. you will not have a /usr (nor a /home) partition.
>
> I recommend:
> 1) Backup all data on this disk (even sd0a, just in case)
> 2) Find some way to get a /usr directory mounted. The easiest way
> is to export /usr from another machine and mount it as /usr.
> (You will have to add the exporting host to your /etc/hosts file,
> and make an entry in your /etc/fstab to mount the new /usr.)
> Boot to single-user mode.
>
> You could also boot from a CD-ROM drive to single user mode.
> As long as you're only using the data on the CDROM, you can
> mess with your disk as much as you need.
> 3) Use the format command, select "partition", and "print" the
> current partition table. Use "g" to resize the g partition to
> the end of disk (add the sizes of the current g & h partitions).
> Use "h" to set the size of the h partition to zero. "Label" the
> disk and exit.
> 4) Use the command "newfs" to create a new filesystem on sd0g.
> 5) Mount /dev/sd0g, and restore your /usr files to it from backup,
> 6) Replace the /usr entry in your /etc/fstab (if you previously
> modified it) and reboot.
>
> While you're doing this, you could extend the size of your swap
> partition as well. You might want to do this if you find yourself
> "out of memory" occasionally.
>
> WARNING: you are correct in assuming that a lot of things can go wrong
> when using format. Double check everything.
Since I has a /usr (and /home) available on another system this
became fairly easy. However, I would add the following comments:
1) Whichever backup system you use, remember that you really want to get
back all of the original file protections and time-stamps (if possible).
I was using tar, so the restore required a "p" option.
Also, do *not* save things with absolute pathnames (/usr/...). When
you get to restoring them /usr is *not* the one you want to end up with
(it is nfs-mounted from another system!). You need to save with
relative names, mount the new partition as /newusr and put everything
into that.
2) Make sure that your dumps do *not* contain any "core" files (which
take up more space on restores) or "swap" files (quicker just to mkfile
them again afterwards).
3) When you do the restores you will be running in single-user mode with
a "sun" console. This scrolls slowly and, as I used the "v" option to
tar for part of the restores, appeared to slow things down.
4) I can't see any point in extending my swap partition, as it only
needs to be large enough to boot with (which it is). For additional
paging space I can just use mkfile for a swap filesystem (which I do).
5) I also wanted the data from /home, so restored that to (into what
would be /usr/home). I then "undid" all of the links that had been form
the /usr to /home file-systems and mv'ed the files to the correct place
instead (this cross fs linking was part of the reason I wanted to
combine them).
That's about it. Now for what went wrong. Simply that I left the
"nfs" bit out of the /usr and /home entries in /etc/fstab, so when I did
the initial re-boot into single user mode I got error messages about bad
lines in fstab, file-systems not mounted in read-write mode.
At this point Panic (not a unix panic - a human one) set in. I
tried "df" to see what was mounted. "df" not found. Nothing seemed to
work. No "mount" (or perhaps it was there but "mount /dev/sd3g /usr"
failed, which isn't surprising as it should be sd0g - can anyone explain
why sd3 is device 0, sd0 is device 3 while sd1 is device 1???).
Apparently nothing. So I "borrowed" a CD drive and booted off that.
This at least booted, but I couldn't find a "mount" anywhere (perhaps
someone could confirm that??) so there was nothing useful that I could
do from there.
A bit of reason then re-entered my brain and I booted of disk to
single user mode again and tried "ls". Amazing - there was the "/"
partition. Don't ask me how I missed this before...
But the disk is still read-only so:
1) mount -o remount / (cribbed from the /etc/rc.single script)
2) mount /dev/sd0g /usr
3) PATH=.....
and I was back with a useable editor (uemacs) and fixed fstab.
Thanks to the following for their replies:
Heas <heas@chpc.org>
Andrew Watson <ajw@ansa.co.uk>
Jim Davis <jdavis@cs.arizona.edu>
Charles <mcgrew@cs.rutgers.edu>
macphed@dvinci.usask.ca (Ian MacPhedran)
tom@yac.llnl.gov
djiracek@jupiter.uucp (Dan Jiracek)
eeikhey@eeiua.ericsson.se (Kevin Heagney)
era@ncar.ucar.edu (Ed Arnold)
"Robert D. Worsham" <worsham@aer.com>
dlp@medphys.ucl.ac.uk (Dave Plummer)
Postmaster <Piete.Brooks@uk.ac.cam.cl>
mharris@jpmorgan.com (Michael Harris)
strombrg@hydra.acs.uci.edu
jdschn@nicsn1.monsanto.com (John D Schneider)
Tim Perala <tperala@ua.d.umn.edu>
john@oncology.uthscsa.edu (John Justin Hough)
shankar@ulysses.att.com
rickn@copley.com (Richard J. Niziak)
Susan Thielen <thielen@irus.rri.uwo.ca>
zshouben@PCS.CNU.EDU (Shouben Zhou)
mandrews@vcrt.hq.videocart.com (Mike Andrews)
perryh@pluto.rain.com (Perry Hutchison)
kevin@uniq.com.au (Kevin Sheehan {Consulting Poster Child})
"Y.TSUJI" <ytsuji@cfi.waseda.ac.jp>
derekt@pwcs.stpaul.gov (Derek Terveer)
twilight!bcutter@relay.EU.net (Brooks Cutter)
eedbew@teamos.ericsson.se (Bernhard Weinelt)
C.Gibson@ucc.hull.ac.uk
glenn@uniq.com.au (Glenn Satchell - Uniq Professional Services)
anderson@neon.mitre.org (Mark S. Anderson)
mikey@netcom.com (Mike Pechner)
Birger.Wathne@vest.sdata.no (Birger A. Wathne)
megatek!geoff@uunet.UU.NET (Geoffrey R. Walton)
jhunter@PCS.CNU.EDU (Thar is grumpy)
rwolf@dretor.dciem.dnd.ca
----------- Gordon Lack ----------------- gml4410@ggr.co.uk ------------
The contents of this message *may* reflect my personal opinion. They are
*not* intended to reflect those of my employer, or anyone else.
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:08:01 CDT