Subject: Re: HowTo move NetBSD 2.0.2 from larger to smaller HardDisk?
To: None <netbsd-help@NetBSD.org>
From: James K. Lowden <jklowden@schemamania.org>
List: netbsd-help
Date: 07/19/2005 22:36:40
bsd.petr@seznam.cz wrote:
> James K. Lowden napsal(a):
> >bsd.petr@seznam.cz wrote:
> >  
> >>i need to move my NetBSD 2.0.2 from old 4 GB HDD to new 1.2 GB HDD. 
> >
> >There are many free alternatives.  One is http://www.feyrer.de/g4u/.  
> >
> Thanks for above link. I have a idea. Is it possible way tu resize UFS 
> partition without data-loss to a smaller (equal or lower then 1.2 GB) 
> size (which program or command can do it)? 

Not that I know of, but more important, it's a bad idea.  

One difference between newbies and gurus: gurus distrust magic. 
Filesystems aren't *meant* to grow and shrink, and programs that grow and
shrink them almost certainly -- not that I understand them in any detail
-- take some shortcuts with your data.  If the "UFS shrinker" crashes in
mid-shrink, what state do you suppose it will leave the filesystem in? 
Where will your data be?  If it's OK to destroy the filesystem, why are we
moving the data in the first place?  

Treat your data with care.  Copy, verify, then remove.  Not only will you
keep your data intact, you'll live longer, too.  :-)

> Yes but I installed only a few packakges as i need. I think which 
> unneeded folders from NetBSD 2.0.2 installation i can delete and this 
> operation do NOT harm the operating system. (Now my partiton with NetBSD
> 
> occuping 1.45 GB and i have to reduce it.)

I think I see now.  You want to know what parts of the operating system
you can safely remove.  Well, as long as you're taking advice from
strangers on the Internet, I'll tell you what I would do in your shoes. 
I'd install NetBSD on the new drive, then update /etc, and then move my
data & packages.  

0.  Be awake and sober.  After breakfast is good. 
1.  Install wd1
2.  Boot the install kernel.  You can do that with your install floppy or
CD, or you can put netbsd-INSTALL.gz in your / partition, and choose it by
name with boot(8) when you reboot.  
3.  Create on wd1 two partions: 'a' for everything and 'b' for swap.  
4.  Choose your sets:

	yes	base.tgz
	yes	comp.tgz
	no	etc.tgz
	no	games.tgz
	yes?	man.tgz
	yes?	misc.tgz
	yes	netbsd-GENERIC.gz
	yes?	text.tgz
	
    Skip X for now:
	no	xbase.tgz
	no	xcomp.tgz
	no	xetc.tgz
	no	xfont.tgz
	no	xserver.tgz

    The ones marked "yes?" are nice to have and take only ~50 MB, but the
OS runs without them.  They just make *you* more efficient.  I suggest you
add X later when you know you have room, if you decide you want it.  

    Don't install etc.tgz because you're going to copy it from wd0.  If
sysinstall won't let you skip it, that's OK.  Get it; you'll overwrite it
later. 

5.  Install, reboot (on wd0).  Now you're halfway home. wd1 is now
bootable. 
6.  You can use pax(1) to copy your data.  For example:

	mount /dev/wd1a /mnt
	pax -rw -pe /etc /mnt/etc

    will copy your /etc directory to its new location.  Do that with:

	/etc
	/your/data
	/usr/pkg
	/var/db/pkg

    If you run out of room, you'll have to trim your packages (or your
data).  The base system takes a few hundred MB; swap is probably < 128 MB
on your system.  No ox to gore there.  That leaves >700 MB for packages
and data.  I would expect everything to fit.  

7.  Boot wd1 in single-user mode: "boot hda1:netbsd -s".  Take a look
around.  You can start the network with "/etc/rc.d/network start".  It
should be OK.  

8.  Shutdown.  Swap the drives.  Reboot. 
9.  Enjoy the afternoon.  Go outside.  

> PS: Im newbie in BSD world. I using M$ on desktop and a little linux on 
> students servers. 

How long you stay a newbie, as you probably know, depends more on attitude
than aptitude.   If you follow the course I outlined, you'll be in charge.
 You'll be able to confirm what you've done at each step, learning as you
go, never putting your data at risk.  You just install a new system and
copy a few files.  Anytime you want, you can start over.  The computer
won't mind.  

I've used M$ too, since DOS came on one floppy and ran on a 0.00477 GHz
CPU, and I've been using NetBSD only since 2000.  NetBSD keeps getting
easier and Windows keeps getting harder.  You tell me why.  

> But one of theese serveres have something bad on motherboard and NetBSD
> is only one stable system on this hardware

That's bad news.  It might be stable now, but hardware never heals. 
NetBSD doesn't demand much to boot up, but a running system can stress the
hardware and find its faults, if there are any.  

> And so, IMHO, NetBSD is prittyest from BSDs.

Well, you know.  That goes without saying.  ;-)

--jkl