Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jan 2009 11:28:02 -0500
From:      Jerry McAllister <jerrymc@msu.edu>
To:        Grant Peel <gpeel@thenetnow.com>
Cc:        Jerry McAllister <jerrymc@msu.edu>, FreeBSD Questions List <freebsd-questions@freebsd.org>
Subject:   Re: Replace SCSI Drive
Message-ID:  <20090108162802.GA97347@gizmo.acns.msu.edu>
In-Reply-To: <A39FF17E1AF24D1882A617913D40EE6B@GRANTPC>
References:  <9F57CF00DDE541E69F500E26B652DDED@GRANTPC> <20090107205826.GA93439@gizmo.acns.msu.edu> <A39FF17E1AF24D1882A617913D40EE6B@GRANTPC>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jan 07, 2009 at 05:26:24PM -0500, Grant Peel wrote:

> Jerry,
> 
> I gave my head a shake (literally), and re-read you response. Please 
> forgive the silly question about dd. I understand that you are getting me 
> to wipe the disk first. I now understand pretty much everything you have 
> written and the procedure involved.

That would be a new high point for me then.
I have often been told the opposite.

> Since I do have the 'newer' drive currently installed at home, I would like 
> to do to 'new' disk setup here first, that way, I can take to machine down 
> for as short a time as is possible.

You can do that, though building the drive is the least of the 
time consumers and hardly noticable compared to dumping/restore 20GB.

> I am quite nervous using the disklabel command(s) as I know nothing about 
> the 'geometry' numbers and how to calculate them.

You don't have to know anything about geometry except maybe the small item
that blocks are 512 bytes in size.  You should also remember that inside of
the computer 1K = 1024 BYTEs, 1M = (1024 X 1924) BYTES 
and 1GB = (1024 X 1924 X 1924) Bytes which is different from how manufacturers
account them.  (They use 1,000 BYTEs for 1K, 1,000,000 BYTEs for 1M, etc)
Otherwise, it is just total number of blocks per partition up to the total
size of the slice.   

Knowing about geomtry implies knowing about block, track and cylinder sizes, 
placement of MBRs, boot sectors and even about reserves for remapping, etc.   
You don't care about any of this except block size.

> 
> Considering your method, and Matthews method, let me run this by you...
> 

I think Matthew posted his method just as an alternative because you
had questions, not because he means it as a preferred method.  I think
mine, in total, is more straightforward.

> At home:
> 
> 1. Boot a machine (this one at home) with freebsd 6.4 installable disk 
> (made from an ISO image),
> 
> 2. Run sysinstall,

Skip using sysinstall here.   
Just use the fdisk, bsdlabel and newfs the same as I posted.   If it is 
the same FreeBSD version as the one your are replacing, then you can hook 
the disk up in the second SCSI slot and just become root and run things the 
same way as from the fixit, (but do it to device  da1  instead of da0).    
If the versions are dissimilar, or, if you can't put the drive in the 
second SCSI slot, then use the fixit system, just like I already posted.

> 
> 3. Use fdisk and disklabel to setup the slice/partitions, paying special 
> attention in disklabel to make the disk bootable,

If you use the commands I gave for fixit, this will all take place
just as you want it, including making it FreeBSD bootable.

> 
> At the network center:
> 
> 4. Move the current *suspect* drive to da1, and install the new drive as 
> da0,
> 
> 5. Boot the machine using the fixit shell, and mount the new partitions and 
> the old partitions as Jerry explained below,
> 
> 6. Do the dump/restore as Jerry mentions below.
> 
> 7. Remove the da1, reboot and hopefully, rejoyce.

This part is the same.   You don't need to remove da1 at this time, but
you can, as you wish.

> 
> Comments please.

See above.

////jerry

> 
> -Grant
> 
> ----- Original Message ----- 
> From: "Jerry McAllister" <jerrymc@msu.edu>
> To: "Grant Peel" <gpeel@thenetnow.com>
> Cc: "FreeBSD Questions List" <freebsd-questions@freebsd.org>
> Sent: Wednesday, January 07, 2009 3:58 PM
> Subject: Re: Replace SCSI Drive
> 
> 
> >On Wed, Jan 07, 2009 at 01:31:25PM -0500, Grant Peel wrote:
> >
> >>Hi all,
> >>
> >>I currently have a SCSI drive that *may* be going bad on one of my 
> >>production servers. I have lots of backups :-)
> >>
> >>Scenario:
> >>
> >>The drive that is showing the occasion error, is a 76 GB Seagate SCSI 10K 
> >>spin drive. It is at the network center about 120 miles away. This drive 
> >>is not using anywhere near 76 GB, and the server will never need 76 GB. I 
> >>estimate its using about 20 GB now.
> >>
> >>I am at home, and have a barely used 36 GB Seagate 10K SCSI drive here, 
> >>currently hooked up to my home (Windows XP BOX) via an Initio SCSI 
> >>adaptor.
> >>
> >>What I would like to do is:
> >>
> >>Using my windows box, FDISK and set up the disk slices at home, using 
> >>some kind of FreeBSD boot disk. I will of course, make sure there is 
> >>enough room on each file system to accomodate the data from the other 
> >>(going bad) disk.
> >>
> >>Take the pristine disk to the Network Center,
> >>
> >>Shut down all software on the machine that has the bad disk, and make 
> >>full dumps of all filesystems on that machine (/, /var, /home, /usr) and 
> >>move the over to the new formatted drive.
> >>
> >>Since I have never done this before, I have some questions:
> >>
> >>!. Can I use a FreeBSD bootable installation disk (6.4) made from an ISO 
> >>image, to boot my PC and make the filesystems on the 36GB drive, without 
> >>actually installing FreeBSD? (Please feel free to tell me exactly how 
> >>:-)).
> >>
> >>2. Once I get that drive to the network center, and restore the dumps to 
> >>it, how do I ensure the drive is bootable? (I assume I actually do that 
> >>in the previous step).
> >>
> >>3. Is it possible to skip step one altogether and use the instructions in 
> >>the  man pages regarding "Restoring a filesystem" and makeing the 
> >>'Pristine' filesystem? If so, again, how do I ensure the disk is 
> >>bootable?
> >>
> >>Thanks a billion in advance,
> >
> >
> >
> >I have a few questions.
> >
> >First, it sounds like this is the boot disk and is the only disk on
> >the machine.   Is this true?   If it is not the boot disk, then it
> >is very easy.  If it is the boot disk, then it is still easy, but
> >just a little more work.
> >
> >Second, since you have to take the replacement disk to the Network Center
> >and do the dumps and restores there anyway, why bother doing the fdisk,
> >bsdlabel and newfs remotely?   That is the easy and quickest part anyway.
> >So, just do it there.   Oh, can you get a console on the machine?  I 
> >presume
> >so if you were going to do the dump/restore there.
> >
> >So, presuming some things:
> >1.  It is the only disk and is the boot disk.
> >2.  FreeBSD is the only thing you want on the disk - no dual boot.
> >3.  You can get a console on the machine at the Network Center.
> >4.  You can successfully burn and test a boot CD with the fixit image.
> >    It used to be that the fixit was included on disc 1, but in case it
> >    has moved, check out its location.  Might still be there.  Just find
> >    a spare machine -  even one running MS and boot the CD and select
> >    the fixit image.   If it comes up, then just pull it and reboot.  You
> >    don't have to bring it all the way up just to test if it is there.
> >
> >    Make sure the fixit comes from the same version as the one you are
> >    restoring to the system or you could have a problem, though probably
> >    not if they are all 6.x or 7.x.
> >
> >    Some of them talk about a holographic image.   I never understood
> >    what that was supposed to mean.   I sort of expected to see a full
> >    3D image of BSDie to materialize in my office and, possibly in
> >    Kirk McKusick's voice, tell me how to do whatever it is.  But, that's
> >    never happened.    Not enough drugs, I suppose.
> >
> >Anyway, take your CD with fixit and the one you can run sysinstall from, 
> >just
> >in case and trundle on over to where that machine resides.
> >
> >Shut down the machine.
> >
> >Pull out the old disk and slide it in to the #2 SCSI slot (or leave it out
> >until the dump/restore phase if you get nervous).
> >Put the replacement disk in to the #1 (boot) SCSI slot.
> >
> >Plug in the monitor and keyboard.
> >
> >Pop in the CD with the fixit and boot up.
> >
> >Fixit runs from an image in memory, not from a hard disk, but, unless
> >you look at devices, it looks like it is running just like you are
> >used to.   Maybe that's what they mean by holographic???  The important
> >thing about this is that the devices are different and any file you
> >create in the mounted root will disappear when you reboot.   You may
> >need to think out just where you are doing something.
> >
> >If it is a SCSI disk, the replacement disk should not be /dev/da0
> >If you do a df(1) you should see the memory device for /
> >
> >Do the following:    (You may need to stick in a dd before the fdisk and
> >                     bsdlabel if it already has an incompatible label on
> >                     the disk or maybe none at all, but probably not)
> >
> >#  (dd if=/dev/zero of=/dev/da0 bs=512 count=4096)   only if needed
> >#  fdisk -BI da0
> >#  (dd if=/dev/zero of=/dev/da0s1 bs=512 count=4096) only if needed
> >#  bsdlabel -w -B da0s1
> >#  bsdlabel -e da0s1
> >
> >The fdisk makes it an all FreeBSD bootable single slice with default MBR.
> >The first bsdlabel writes an initial label in that slice and puts
> >in the boot block.
> >The second bsdlabel brings up an edit session with the information for
> >partitioning that single FreeBSD slice.   It will show one c partition
> >which identifies the whole size of the slice.    Leave that c partition
> >alone.   But, you can copy it to make the others and just muck with
> >the numbers onb them.  Looks like you want partitions for / /var /home 
> >/usr.
> >You should also make one for swap and /tmp.  So, a=/, b=swap, d=/tmp,
> >e=/usr, f=/var and g=/home.  Actually, make the letter names for the
> >partitions match what you have now.
> >
> >You will first see something that looks something like:
> >(The exact number will reflect the actual disk slice size)
> >Remember, it is stated in 512 byte blocks (or sectors, same thing)
> >
> >
> >8 partitions:
> >#        size   offset    fstype   [fsize bsize bps/cpg]
> > c: 75497472        0    unused        0     0         # "raw" part, don't 
> >edit
> >
> >
> >To make the disk partitions be:
> >(I am just guessing on sizes     /=256MB,
> >based on a machine I have       swap=1024MB,
> >with a similar sized disk,      /tmp=512MB,
> >but if they are like this,      /usr=4096MB (eg 4 GB),
> >then                            /var=4096MB (eg 4 GB)  and
> >                                /home gets all the rest
> >
> >You might want to become root and then run:     bsdlabel -e da0
> >before shutting the machine down just to see what is there, though
> >the numbers will be different since you are putting in a different
> >sized disk.   Make sure you  q!  to get out of the bsdlabel and do
> >not do a write or you could cause yourself some nasty trouble - though
> >it shouldn't let you actually do the write, I wouldn't want to
> >test it out accidently.
> >
> >You want to edit it to make it look something like:
> >
> >8 partitions:
> >#        size   offset   fstype  [fsize bsize bps/cpg]
> > a:   524288        0   4.2BSD    2048 16384 32776
> > b:  2097152        *     swap
> > c: 75497472        0   unused       0     0        # "raw" part, don't 
> >edit
> > d:  1048576        *   4.2BSD    2048 16384     8
> > e:  8388608        *   4.2BSD    2048 16384 28552
> > f:  8388608        *   4.2BSD    2048 16384 28552
> > g:        *        *   4.2BSD    2048 16384 28552
> >
> >By using the '*' for offset, bsdlabel will calculate it correctly.
> >By using '*' for size on the last partition (g in this case), bsdlabel
> >will put all the rest of the usable space in that partition.   But, the
> >first offset needs to be specified as '0' and c must be left alone.
> >
> >When you write and exit the edit session, bsdlabel will write the
> >partition table to the slice and it is now completely labeled.
> >
> >Finally you want to newfs each partition.   Taking the defaults
> >should be just fine, but remember, you have to use the full device
> >name on the newfs command, not shortened as in fdisk and bsdlabel.
> >(Note, do not newfs the swap partition or the 'c' partition)
> >
> > newfs /dev/da0s1a
> > newfs /dev/da0s1d
> > newfs /dev/da0s1e
> > newfs /dev/da0s1f
> > newfs /dev/da0s1g
> >
> >Now the disk is ready to write.   You must make mount points and mount
> >the partitions.
> >
> > mkdir /oldroot
> > mkdir /newroot
> > mkdir /oldusr
> > mkdir /newusr
> > mkdir /oldvar
> > mkdir /newvar
> > mkdir /oldhome
> > mkdir /newhome
> >
> >(unless you have been doint something foolish, you don't have to
> >dump/restore anything from /tmp)
> >
> >Presuming you put that old disk in the second SCSI slot, which
> >would make it /dev/da1 (and presuming my speculative partition
> >assignments are what you used - use what you really have)
> >
> > mount /dev/da0s1a /newroot
> > mount /dev/da1s1a /oldroot
> > mount /dev/da0s1e /newusr
> > mount /dev/da1s1e /oldusr
> > mount /dev/da0s1f /newvar
> > mount /dev/da1s1f /oldvar
> > mount /dev/da0s1g /newhome
> > mount /dev/da1s1g /oldhome
> >
> >Then do the dump/restores from the old disk to the new.
> >
> > cd /newroot
> > dump 0af - /oldroot | restore -rf -
> > cd /newusr
> > dump 0af - /oldusr | restore -rf -
> > cd /newvar
> > dump 0af - /oldvar | restore -rf -
> > cd /newhome
> > dump 0af - /oldhome | restore -rf -
> >
> >At this point, remove the CD and reboot and it should work just fine.
> >Your old disk will still be there if you want to look at it for anything,
> >but everything should be on the new one.  Note:  remember those mount
> >points you created for the dumps will be gone after the reboot, because
> >they are created in that memory file system of the fixit.  So, if you
> >want to mount something from the old disk, you will need to make the
> >mount points again.
> >
> >It looks like a lot of stuff, but it actually goes pretty quickly
> >until you get to the dump/restores.   The big ones can take a while.
> >
> >Have fun,
> >
> >////jerry    Jerry McAllister    jerrymc@msu.edu
> >
> >
> >>-Grant.
> >>
> >>P.S. I AM reading all the manuals and handbooks, I just can't afford to 
> >>mess this up :-)
> >>
> >>_______________________________________________
> >>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?20090108162802.GA97347>