Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Mar 2005 15:05:07 -0500
From:      "Paul J. Pathiakis" <pathiaki@pathiaki.com>
To:        freebsd-questions@freebsd.org, bob@a1poweruser.com
Subject:   Re: What's an easy way to replace a drive?
Message-ID:  <200503241505.07562.pathiaki@pathiaki.com>
In-Reply-To: <MIEPLLIBMLEEABPDBIEGAEHMHCAA.bob@a1poweruser.com>
References:  <MIEPLLIBMLEEABPDBIEGAEHMHCAA.bob@a1poweruser.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

	In the worse case scenario, you want to move a system drive.  (If it's 
not a system drive, you get less steps.)

	This is for the NOVICE, I therefore suggest the sysinstall gui to do 
the lifting:

(No, I use bsdlabel, fdisk, etc, but this is more simplistic and 
generates ease-of-use methodology.)

	1) connect the drive to the system.  (NOTE: if you are trying to do a 
system disk and you aren't familiar with bsdlabel, fdisk, etc., connect 
a single disk to the machine and boot the distro CD.)

	2) use sysinstall to partition the drive correctly. (Tools are fdisk 
and bsdlabel.)  Make sure you write an MBR and/or boot blocks to the 
drive.  When creating the partitions, typically, make them look similar 
to the original. /, /usr, /var.  (NOTE:  if you have another drive 
connected to the system, sysinstall will try to create d: as the first 
partition on the new drive when you want it to be a: .  That's why I 
suggest keeping only the new drive connected for now.  Getting real 
familiar with bsdlabel and fdisk can get you around this as you mature 
as a system administrator.)

	3) Write all the changes out to the drive from the partition editor.  
It will label the drive partitions and then newfs. (It will prompt you 
with:  Are you sure you want to do this now? )

	4)  At this point, you can shutdown and connect the system drive and 
bring up the system into single user mode on the initial drive.  Create 
mount points like:  /root2, /var2, /usr2 and mount the NEW drives 
partitions to them.  Do a: mount -a to make sure all partitons on the 
system drive are mounted.

	5) Now, use dump and restore to move everything over.  This will, 
typically, be much faster than dd on a non-full drive.  DD has to read 
everything.  This method just moves the info on the disk.

	for example:

	cd /root2; dump 0af - / | restore xf -
	....
	....
	change permissions on . ? (or something like it) y <ret>
	cd /var2; dump 0af - /var | restore xf -

	etc.

If you just want a simple method of backing up partitions to a file:
(I use the mount points here for simplicity, /home could be replaced 
by /dev/ad0s1f or such.)

cd <partition on new drive>;
dump 0af - /home | gzip > home.dump.gz
dump 0af - /usr | gzip > usr.dump.gz

without gzip...

dump 0af home.dump /home

later to restore,

cd < new location >
gunzip < /<path>/home.dump.gz | restore xf -

without gzip....

restore xf /<path>/home.dump

I tried to make this simple.

P.


On Thursday 24 March 2005 14:08, bob@a1poweruser.com wrote:
> -----Original Message-----
> From: owner-freebsd-questions@freebsd.org
> [mailto:owner-freebsd-questions@freebsd.org]On Behalf Of Anthony
> Atkielski
> Sent: Thursday, March 24, 2005 1:58 PM
> To: freebsd-questions@freebsd.org
> Subject: Re: What's an easy way to replace a drive?
>
> Gary Smithe writes:
> > May not be the best answer, but if the drive's data is still
>
> intact
>
> > (i.e. readable) and the replacement will be identical, maybe try
>
> DD or
>
> > similar from a bootable "rescue" cd, like freesbie?  If not that,
>
> then
>
> > you may be able to copy the data between the 2 drives using same
>
> said
>
> > bootable CD after creating the partitions.
>
> Is it possible to dd the entire contents of one drive into a single
> file
> on another drive (assuming the latter drive is big enough)?  If so,
> I
> could save time by just copying the drive wholesale to a huge file
> on
> another drive, replacing it, then copying everything back.  Not sure
> if
> "whole drive" would include content outside the FS, though (?).
>
> --
> Anthony
>
>
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe@freebsd.org"
>
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200503241505.07562.pathiaki>