Subject: Re: can a partition be expanded?
To: None <port-mac68k@netbsd.org>
From: John Valdes <valdes@macavity.uchicago.edu>
List: port-mac68k
Date: 06/26/1999 15:31:23
Frederick Bruckman writes:
> On Fri, 25 Jun 1999, Fischer, Roger wrote:
> 
> > Would it hurt to temporarily copy the "tar" and "gzip" to the /bin 
> > directory?  Any other programs that I'd need?  Do I need to mount
> > the tape drive or just copy to that device?  Is there a good readme
> > on tape drives?  I haven't used one with unix before
> > 
> > something like:     tar -czvf (tape-device) /usr
> 
> How about "dump"? If it's your only tape drive, just insert a tape and
> 
> 	dump -0uB 4096000 /usr	# wait!
> 	eject tape              # to rewind

I'd recommend dump & restore over tar as well.  dump/restore have the
advantage that they already live in / (/sbin to be exact) and are
statically linked, so you don't have to worry about /usr/lib being
available.

Also, while you're at it, you'd might as well backup all your
filesystems, just in case... :)  You can put multiple dump images on a
single tape (assuming they fit) by using the "no-rewind" tape device,
/dev/nrst0, w/ the dump command, eg:

      dump -0 -u -B 4096000 -f /dev/nrst0 /usr

You'll need to use a separate dump command for each filesystem, eg:

      dump -0 -u -B 4096000 -f /dev/nrst0 /
      dump -0 -u -B 4096000 -f /dev/nrst0 /usr
      dump -0 -u -B 4096000 -f /dev/nrst0 /var
      dump -0 -u -B 4096000 -f /dev/nrst0 /home
      ...

Each dump image is written to tape as a single file, so in the example
above, the first file on tape is the dump image of /, the second is
the image of /usr, etc.  To restore a given image, you will then need
to position the tape to the correct image file on tape.  You can do
this by either rewinding the tape and using the '-s' option w/ the
restore command, eg for /usr:

      mt rewind
      restore -r -s 2

or manually positioning the tape before the restore w/ the mt command:

      mt rewind
      mt fsf 1
      restore -r

For details on tape drives under Unix, see the man pages for mtio and
st, as well as the man page for the mt command (not really a good
README, but all the info is there...).

> To restore an entire filesystem, it's something like
> 
> 	newfs /dev/rsdNx
> 	fsck /dev/rsdNx
> 	mount /dev/sdNx /mnt
> 	cd /mnt; restore -r

In the case of /usr, you'll need to do this in single-user mode, so
that you can unmount /usr before repartitioning and newfs'ing it.

Actually, for repartitioning, is the BSD disklabel command safe to run
on Mac disks, or must one use a MacOS disk partitioning utility?  If
disklabel is safe, then the complete procedure would be:

    - reboot into single-user mode (by setting the appropriate option
      in the NetBSD Booter)
    - umount /usr
    - dump -0 ... /usr (if you haven't already)
    - disklabel -e /dev/rsdNx
    - newfs, fsck, mount, restore as above.

Another potential gotcha is that w/o /usr, you won't have any man pages
either, so be sure you're familiar w/ all the commands above before
proceeding (or print out copies of the relevant man pages ahead of
time). 

John