[comp.sys.att] New Root disk for UNIXPC

todd@ivucsb.sba.ca.us (Todd Day) (08/12/90)

I've been thinking about getting the John Milton disk mod
and getting two hard drives.  I'd like to get about a 100MB
(formatted) drive with under 20ms access time.  Then, I want
to retire my current 67MB(formatted) drive and use it for
news only.  It has served me well these last three years, but
I think it's time to move on (plus, it is fragmented as hell).

Anyway, what I am wondering, is:  What is the least painful way
to copy my entire 67MB drive to the 100MB drive and then make
the 100MB drive my new root drive?  Keep in mind that I want to
somehow unfragment the files in the process, so I think using
dd is out of the questiong.

Also, any comments or suggestions concerning my choice of new
drive would be appreciated...

-- 
Todd Day |   todd@ivucsb.sba.ca.us   |  ucsbcsl!ivucsb!todd
	"I believed what I was told, I thought it was a good
	 life, I thought I was happy.  Then I found something
	 that changed it all..."	   --- Anonymous, 2112

mdapoz@hybrid.UUCP (Mark Dapoz) (08/12/90)

In article <1990Aug11.184541.273@ivucsb.sba.ca.us> todd@ivucsb.sba.ca.us (Todd Day) writes:
>Anyway, what I am wondering, is:  What is the least painful way
>to copy my entire 67MB drive to the 100MB drive and then make
>the 100MB drive my new root drive?  Keep in mind that I want to
>somehow unfragment the files in the process, so I think using
>dd is out of the questiong.

I went through this dillema about 3 times as I kept changing hard drive
configurations.  The easiest way I found to do it was to add the 100 meg
drive as a second hard drive, format it, allocate the boot and swap partitions
and then mount the user parition(s) (ie. /dev/fp012 onward) as something
like /mnt on the running system.  To copy the files to it you can use a
find/cpio pipeline to do it.  This will defragemnt the drive while copying
and will also be very quick (well, relatively quick, the drives are slow).
I've tried using a find/cpio pipeline when booted off of a floppy but it's
very slow because the kernel i/o device for the pipe is the floppy instead
of a hard drive.  I don't recommend doing the copy using the floppy kernel
unless you have a few days to spare.  Once you've copied all the files, you
can then switch the two drives and boot off the 100 meg one.  You may have
to use iv to create the boot partition, I don't think the diag disk does
this for you.  Hope this helps.
-- 
Managing a software development team 	|   Mark Dapoz  
is a lot like being on the psychiatric	|   mdapoz%hybrid@cs.toronto.edu
ward.  -Mitch Kapor, San Jose Mercury	|   mdapoz@torvm3.iinus1.ibm.com

lenny@icus.ICUS.COM (Lenny Tropiano) (08/12/90)

In article <1990Aug11.184541.273@ivucsb.sba.ca.us> todd@ivucsb.sba.ca.us 
(Todd Day) writes:
|>I've been thinking about getting the John Milton disk mod
|>and getting two hard drives.  I'd like to get about a 100MB
|>(formatted) drive with under 20ms access time.  Then, I want
[...]
|>Anyway, what I am wondering, is:  What is the least painful way
|>to copy my entire 67MB drive to the 100MB drive and then make
|>the 100MB drive my new root drive?  Keep in mind that I want to
|>somehow unfragment the files in the process, so I think using
|>dd is out of the questiong.

Well since we don't have a nice utility called dcopy(1M) on the 3B1, we'll
have to settle for the next best thing to copy entire filesystems ...
(BTW: For those who wonder, dcopy is a utility to copy one filesystem to
another, optimizing seek performance based on last accessed files, it also
will group all the blocks so they are contiguous.  I was told this week
by John McMillian (jcm@pegasus.att.com) that there is something even better
called fscopy?  that takes into account size as well as access time.  Of 
course we'll never see something like that for the 3B1 from AT&T ...
volcopy(1M) [also not showing up in our UNIX command subset] copies byte for
byte, bit for bit ... so no defragmentation would occur)

Anyhow, back to what I was saying, the next best thing to use is cpio,
yes, cpio.

# find / -print | sort > /tmp/FILES	(I like sorting my files..)
# vi /tmp/FILES				(Remove anything you don't want copied)
# mount /dev/fp012 /mnt			(Mount that new disk slice of yours...
					 Note root will HAVE to be slice 2,
					 since slice 1 is swap)
# cat /tmp/FILES | cpio -pduvm /mnt
[...]
Sit back and wait as the filesystems get copied over.

# /etc/ldrcpy /dev/rfp000 /dev/rfp010

(This will put a boot loader on the second disk ... copied from the first disk)

Now your set, swap the drives (remembering to swap the drive selects as well)
and you'll be set, with a nice and fast, unfragmented root partition.

|>Also, any comments or suggestions concerning my choice of new
|>drive would be appreciated...
|>

100MB formatted is an odd amount, probably have to go for something like
a Maxtor XT-1140, which is ~113MB formatted, of course you could push
the XT-1140 to the full 1224 cylinders and get ~151MB...  The Maxtor
drive seek times aren't anything terrific though...

Let us know what you decide for a drive ... and how it works out.

-Lenny
-- 
| Lenny Tropiano           ICUS Software Systems        lenny@icus.ICUS.COM |
| {ames,pacbell,decuac,sbcs,hombre,rayssd}!icus!lenny   attmail!icus!lenny  |
+------ ICUS Software Systems --  PO Box 1;  Islip Terrace, NY  11752 ------+

bdb@becker.UUCP (Bruce Becker) (08/12/90)

In article <1990Aug11.184541.273@ivucsb.sba.ca.us> todd@ivucsb.sba.ca.us (Todd Day) writes:
>[...]
>Anyway, what I am wondering, is:  What is the least painful way
>to copy my entire 67MB drive to the 100MB drive and then make
>the 100MB drive my new root drive?  Keep in mind that I want to
>somehow unfragment the files in the process, so I think using
>dd is out of the questiong.

	"dd" won't work because it copies _everything_,
	including the information about the amount of
	disk space used in the file system. (I suppose
	you could make a partition of the exact number
	of blocks as the original, but...)

	Anyway, what you want is

		find /mnt -depth -print | cpio -pdmu /mnt2

	which would be done by making up a floppy file system
	with at least find and cpio on it. You can make a
	copy of disk 3 of the O/S foundation set of the
	installation floppys, and modify its etc/profile so
	as not to take you thru the installation procedure.

	Once you've installed the mod for 2 drives, boot
	the Floppy Boot disk 2 of the foundation set, and
	then use your newly-created floppy file system disk
	when prompted for disk 3.

	Then proceed to mount the old drive on /mnt; then
	mkdir /mnt2 and mount the new drive on it (which you've
	already formatted & made a file system on). Then you
	can issue the find/cpio sequence shown above. Since
	you're writing to a new file system, it will of course
	be unfragmented...

Cheers,
-- 
  ,u,	 Bruce Becker	Toronto, Ontario
a /i/	 Internet: bdb@becker.UUCP, bruce@gpu.utcs.toronto.edu
 `\o\-e	 UUCP: ...!uunet!mnetor!becker!bdb
 _< /_	 "I still have my phil-os-o-phy" - Meredith Monk

bri@tsnews.Convergent.COM (Brian Rice) (08/13/90)

Um... I think I would go with Lenny's version (No offense intended to Mr. 
Becker) merely because of the sort/discard option he suggests.  However,
I don't recall seeing the word 'backup' in either of the follow-ups!
I am currently running the Maxtor 2190's (Thanks Thad) and am also in
agreement with Lenny on this: the seek time is not very good. All that
space on the other hand...

jbm@celebr.uucp (John B. Milton) (08/14/90)

In article <1990Aug11.184541.273@ivucsb.sba.ca.us> todd@ivucsb.sba.ca.us (Todd Day) writes:
>I've been thinking about getting the John Milton disk mod
>and getting two hard drives.  I'd like to get about a 100MB
>(formatted) drive with under 20ms access time.  Then, I want
>to retire my current 67MB(formatted) drive and use it for
>news only.  It has served me well these last three years, but
>I think it's time to move on (plus, it is fragmented as hell).
>
>Anyway, what I am wondering, is:  What is the least painful way
>to copy my entire 67MB drive to the 100MB drive and then make
>the 100MB drive my new root drive?  Keep in mind that I want to
>somehow unfragment the files in the process, so I think using
>dd is out of the questiong.
>
>Also, any comments or suggestions concerning my choice of new
>drive would be appreciated...

Setup the hardware so that the new 100 meg disk (will be root disk) is the
second hard drive. Format it from the diag disk: use "s4test" to get to expert
mode, then use the commands "2,2" to format and "2,23" to check. Use the new
diag if you want to partition it. Reboot with the original 67M as (still) the
first disk.

Make the new disk bootable:
# /etc/ldrcpy /dev/rfp000 /dev/rfp010
# mkfs /dev/rfp012
# fsck /dev/rfp012

Probably the best way to transfer the files is to generate a list of files
first, making sure the target disk is NOT MOUNTED. Do everything with root
permission.

# cd /
# find . -type d -print > /tmp/dlist
# find . ! -type d -print > /tmp/dlist

Edit the lists into the order you want things to be created. Put things like
/bin/sh and /bin/ls first. Put programs that are not used by shell scripts
(or not used at all) further down. Put news last on both the directory list
and the file list. Delete files in /tmp, /usr/tmp from the list. One could
agonize over the correct ordering of the list forever.

# mount /dev/fp012 /mnt
# cd /
# </tmp/dlist cpio -pdm /mnt
# </tmp/list cpio -pdm /mnt

CHECK EVERYTHING ON /mnt TO MAKE SURE IT MADE IT!!

Shutdown

Set the select on the 67M for drive 2 and the select on the 100M to drive 1.
Reboot and MAKE DAMN SURE everything is ok.

Reboot to the diag disk. Reformat and verify the 67M (WHICH IS NOW THE SECOND
DRIVE!!!) with expert 2,2 and 2,23. When it asks you about the size of the
swap partition, answer 0. Our OS can only support one swap area. This will give
you another 5M for news. Reboot to UNIX.

# iv -t /dev/rfp010

Note the number of logical (1k) blocks of partition 2.
# mkfs /dev/rfp012 <1k blocks>:<inodes>
<1k blocks> is the number from the iv command. <inodes> can be as big as 65500.
# fsck /dev/rfp012
# mv /usr/spool/news /usr/spool/onews
# mkdir /usr/spool/news			# new mount point
# chmod 775  /usr/spool/news		# fix the mount point		
# chown news /usr/spool/news
# chgrp news /usr/spool/news
# mount /dev/fp012 /usr/spool/news	# mount the second disk
# chmod 775  /usr/spool/news		# fix the root dirs on the 2nd disk
# chown news /usr/spool/news
# chgrp news /usr/spool/news

Setup mountable and checklist:
# cat >>/etc/mountable
mount /dev/fp012 /usr/spool/news
^D
# cat >>/etc/checklist
/dev/rfp012
^D

# cd /usr/spool/onews
# find . -depth -print|cpio -pdm ../news

Check to make sure news is really there in the /usr/spool/news tree.

# rm -rf /usr/spool/onews

Reboot to make sure everything gets FSCKed and MOUNTed properly.

Everything will be, of course, unfragmented.

John
-- 
John Bly Milton IV, jbm@uncle.UUCP, n8emr!uncle!jbm@osu-cis.cis.ohio-state.edu
(614) h:252-8544, w:469-1990; N8KSN, AMPR: 44.70.0.52; Don't FLAME, inform!

lenny@icus.ICUS.COM (Lenny Tropiano) (08/14/90)

In article <632@tsnews.Convergent.COM> bri@tsnews.Convergent.COM (Brian Rice) writes:
|>
|>Um... I think I would go with Lenny's version (No offense intended to Mr. 
|>Becker) merely because of the sort/discard option he suggests.  However,
|>I don't recall seeing the word 'backup' in either of the follow-ups!
|>I am currently running the Maxtor 2190's (Thanks Thad) and am also in
|>agreement with Lenny on this: the seek time is not very good. All that
|>space on the other hand...

You're right, but I think those who are thinking about this procedure 
know that you copying the root filesystem from one drive
to another, therefore by the very nature of that operation you have a
backup.   :-)

I guess the disclaimer should be ...

***************************************************************************
  DON'T FORMAT, MKFS, OR DESTROY YOUR ORIGINAL ROOT FILESYSTEM UNTIL YOU 
  VERIFY THE NEW ONE ACTUALLY WORKS AND EVERYTHING YOU WANT IS THERE!
***************************************************************************

Yes, folks even the best of us goof once and a while.  I remember helping
a good friend of mine swap some HD's around, while I was at her
console (su'd as root) I decided to re-mkfs the slice 2 on the second
drive (for those that don't know it's /dev/rfp012).  Well as things go in
those intense 'hacking' sessions... a slip up of one little number and POOF!  
Well I hate to admit it (and now as she is probably reading this, she's 
rolling in her seat ...) I typed:

# mkfs /dev/rfp002

Tick... tick... tick.  Aborting the procedure prematurely, but too late
to save anything ... And feeling very embarrased, as well as very
much responsible -- I non-chelantly [sic] said, "Do you have a recent
backup of your root filesystem?"  Of course I was handled the 90+ 
diskettes.  [I guess that's better than most UNIXpc'ers]  Two hours and
then some later, things were back to some semblance ...

The moral of the story is ... BACKUP, IT'S WORTH THE EFFORT!

-Lenny
-- 
| Lenny Tropiano           ICUS Software Systems        lenny@icus.ICUS.COM |
| {ames,pacbell,decuac,sbcs,hombre,rayssd}!icus!lenny   attmail!icus!lenny  |
+------ ICUS Software Systems --  PO Box 1;  Islip Terrace, NY  11752 ------+

upl@gumby.cs.wisc.edu (Undergrad Projects Lab) (08/15/90)

In article <632@tsnews.Convergent.COM> bri@tsnews.Convergent.COM (Brian Rice) writes:
>Um... I think I would go with Lenny's version (No offense intended to Mr. 
>Becker) merely because of the sort/discard option he suggests.  However,
>I don't recall seeing the word 'backup' in either of the follow-ups!
>I am currently running the Maxtor 2190's (Thanks Thad) and am also in
>agreement with Lenny on this: the seek time is not very good. All that
>space on the other hand...

Well, here comes the word 'backup'.  WARNING: If you LOATHE the UA hit
'n' right now.  I don't like it much either, but . . .

How come no one has mentioned doing this:
	A) do a full backup via the UA,
	B) swap old HD with new HD
	C) use the diagnostics diskette to format the new drive,
	D) load Foundation Set
	E) then use the UA to do a full restore. 
It has its disadvantages (i.e. it's SLOW, it's REALLY S...L...O...W...) but it
works and it's simple.  And since it uses cpio, I assume that it will also
defragment the disk as one would like.  This solution also works if you don't
happen to have any means of mounting the extra hard drive.  Did I mention that
it takes some time?  

It does have some advantages.  You don't have to worry about the loader, or the
swap space, AND you have a backup of your system when you're done.

This worked for me when I bought a bigger drive.  Of course, it took about
5 hours just to migrate from a 20 meg to a 40 meg drive.  Most of the time
was spent in the scintillating process of backup and restore.  The rest in the
equally stimulating process of formating.  Ok, so it's not a good suggestion
if you can mount the extra drive, but if you can't it will work fine.

- sparkie