Subject: Re: Drive space question
To: Mark R. Nathan <mark@nathan.net>
From: Kevin P. Neal <kpneal@pobox.com>
List: netbsd-help
Date: 08/07/2000 09:11:38
On Sun, Aug 06, 2000 at 10:32:36PM -0700, Mark R. Nathan wrote:
> 
>    As an early NetBSD / Unix student I have run in to a problem with
>    drive space limitations now.
>    
>    Is it possible for me to literally copy or make a disc image of the
>    drive and move that image to a larger SCSI drive?  Can this be done
>    through a non unix environment such as Mac OS or in Unix only?

Well, ... yes, but I don't think that's quite what you want. 

You can use the "dd" command to make a whole-disk copy. For example, if
you are on a i386 box and your old drive is sd0 with the new drive sd1:

dd if=/dev/rsd0d of=/dev/rsd1d

This copies the data over from the old to the new drives. However, it makes
the new drive appear to be the same size as the old drive. You could fixup
the disklabel but that has other issues depending on how your partitions
are laid out. 
    
>    Can I format a larger drive with a root/usr partition and a swap
>    partition... and copy files and folders from the smaller drive to the
>    larger drive?

Yes. Use the dump and restore commands to copy each filesystem on your
old disk to it's matching filesystem on the new drive. Make sure you install
a bootblock on the new drive (typically done with the installboot command).
Make sure you fix the /etc/fstab file on the new drive to mount the 
partitions from sd1 instead of sd0 (or whatever your new and old drives
are). Then reboot off the new disk, leaving the old in place if needed
(for now).
    
>    If I choose to just add another drive,  can I install BSD specific
>    components such as comp.tgz and pkgsrc to this drive without opening a
>    can of worms?  I'm uncertain how pkg_add will react on a new drive
>    without the directory tree of the sd0a drive.

Your best bet is to move your whole install over to the larger disk. If
you don't want to do that, move just /usr over to the new (presumably
larger) disk. Moving just /usr is similar to moving the whole install
except there is no messing with a new root, and no messing with boot blocks.
-- 
Kevin P. Neal                                http://www.pobox.com/~kpn/

"In feeling small you gain the info you need."
     Ross Smith, on humility                        Apr 22 1999 2:22am