Subject: RE: can a partition be expanded?
To: Fischer, Roger <RFischer@PanAmSat.com>
From: Michael Maciolek <mikem@ne.cohesive.com>
List: port-mac68k
Date: 06/28/1999 15:33:06
I'm a little surprised no one else has suggested this yet, though I
don't know if there are specific issues in the mac port that would
cause problems.  I've only done this sort of things on Sparcs, so if
there are disk-labeling issues peculiar to Macs, beware.

Depending on your partition layout, it *might* be possible to use
your swap partition to hold a temporary copy of /usr, then expand
your real /usr into your additional 400 meg of space, then copy
/usr back from the swap partition to the newly expanded partition.

The benefit is that you do everything in-place, without relying on
a tape drive.  The down-side is that this takes a few more steps,
and (obviously) doesn't work if your swap partition isn't big enough
to hold a temporary copy of /usr.

(NetBSD is perfectly happy to run without any disk-based swap space.
As long as you have enough RAM to boot and run in single-user mode,
you can try this.)

If swap is sd0b, /usr is sd0f, and the new space comes right after
sd0f, then you'd do something like this:

	<comment out the 'swap' line in /etc/fstab>
	<reboot to single-user mode>
	newfs /dev/rsd0b
	mount /dev/sd0b /mnt
	dump 0f - /usr | (cd /mnt; restore rf -)
	umount /mnt
	<edit /etc/fstab to mount /dev/sd0b as /usr>
	<reboot to single-user mode>

Now you're using sd0b as /usr, so you can blow away the copy of /usr
in sd0f and expand that partition to use your added 400m space.

	disklabel -w /dev/rsd0c
	<edit the disklabel to use the additional space>
	newfs /dev/rsd0f
	mount /dev/sd0f /mnt
	dump 0f - /usr | (cd /mnt; restore rf -)
	umount /mnt
	<edit /etc/fstab to use /dev/sd0f as /usr again>
	<reboot single-user>

Ta daa!  You now have an expanded /usr.  Now you no longer need the
temporary copy in your swap partition.  You can re-enable sd0b as
your swap partition.

	<edit /etc/fstab to use /dev/sd0b as swap space>
	swapon /dev/sd0b
	<bring it up multi-user>

...and you're done.  At no time during this whole procedure did you
ever have to go without a complete /usr partition.

Granted, this only works if sd0b is big enough to contain /usr, but
I would feel a lot better going this route knowing that my machine
always had a fully functional /usr at every step along the way.

Regards,
Michael Maciolek


  >At 22:57 Uhr +0200 25.06.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