Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Making a bootable second hard disk (and larger filesystems)

207 views
Skip to first unread message

Jorge_Beteta

unread,
Jun 24, 2003, 12:46:42 AM6/24/03
to
Hello,
I need to pass an SCO UNIX 3.2v4.2 from disk1 to disk2 (both disks are
IDE), because disk1 is 94% full. So, I need to make a larger "root"
filesystem on disk2 and it has to be bootable.
I don't have a tape recorder, so I have to do everything on disk2.
I know that I have to use dd utility, so eventually I can make disk2
bootable.
I've been evaluating LoneTar AirBag and RescueRanger, but it hasn't
backup on second hard disk, just on tapes.
How can I use dd? I'm trying to do:
#dd if=/dev/rhd00 of=/dev/rhd10
and it works, but just as cloning disk. I can't make any filesystem
larger.
How can I copy "boot", "swap", "root" and "recover" filesystem exactly
as they are from disk1 to disk2? Besides I have to make a larger
"root" filesystem on disk2.

Is it correct:
for my boot filesystem:
#dd if=/dev/rhd00 of=/dev/rhd10 bs=1539b count=1
for my swap filesystem:
#dd if=/dev/rhd00 of=/dev/rhd10 bs=100351b skip=1539b count=1
for my root filesystem:
#dd if=/dev/rhd00 of=/dev/rhd10 bs=412469b skip=101890b count=1
for my recover filesystem:
#dd if=/dev/rhd00 of=/dev/rhd10 bs=9b skip=514359b count=1

and so on? (I'm just adding and resting the block sizes of my disk1
filesystems showing in divvy)
#divvy
Name Type New FS # First Block Last Block
----- ------ ------ --- ----------- -----------
boot EAFS no 0 0 15359
swap NON FS no 1 15360 115711
root HTFS no 2 115712 528181
NOT USED no 3 - -
NOT USED no 4 - -
NOT USED no 5 - -
recover NON FS no 6 528182 528191
hd0a WHOLE DISK no 7 0 531183


Sorry if there are too many questions.
Thanks in advance!

Rainer Zocholl

unread,
Jun 23, 2003, 11:57:00 PM6/23/03
to
(Jorge_Beteta) 23.06.03 in /comp/unix/sco/misc:

>Hello,
>I need to pass an SCO UNIX 3.2v4.2 from disk1 to disk2 (both disks are
>IDE), because disk1 is 94% full. So, I need to make a larger "root"
>filesystem on disk2 and it has to be bootable.

>I don't have a tape recorder,

how you do backup???

>so I have to do everything on disk2.

>I know that I have to use dd utility,

Without a "backup" don't even whistle "dd" in the neighborhood of
a server! ;-) (*)

> so eventually I can make disk2 bootable.

>I've been evaluating LoneTar AirBag and RescueRanger, but it hasn't
>backup on second hard disk, just on tapes.

Not on "normal" files, NFS mounts?


>How can I use dd? I'm trying to do:
>#dd if=/dev/rhd00 of=/dev/rhd10
>and it works, but just as cloning disk.
>I can't make any filesystem larger.

On some OS you have "fdisk"
That will show you that there is now new "unpartioned"
space on the new disk!

have you tried "divvy" on the second disc? (See tonies great pages)


Too there are tools to increase partition size.
(gpart, fips etc.) but usually they don't work with SCO FS AFAIK ;-(

On SCO it's all a little bit different...
Are there tools to increase FS size?

>How can I copy "boot", "swap", "root" and "recover" filesystem exactly
>as they are from disk1 to disk2? Besides I have to make a larger
>"root" filesystem on disk2.

To increase "root" is an unusal/unnessacary wish IMHO.

Why can't you "link" or "mount" the too much growing
directory to a bigger FS?


>Is it correct:
>for my boot filesystem:
>#dd if=/dev/rhd00 of=/dev/rhd10 bs=1539b count=1
>for my swap filesystem:
>#dd if=/dev/rhd00 of=/dev/rhd10 bs=100351b skip=1539b count=1
>for my root filesystem:
>#dd if=/dev/rhd00 of=/dev/rhd10 bs=412469b skip=101890b count=1
>for my recover filesystem:
>#dd if=/dev/rhd00 of=/dev/rhd10 bs=9b skip=514359b count=1


>and so on? (I'm just adding and resting the block sizes of my disk1
>filesystems showing in divvy)

bs is "block size" naming the amount read on one "strike"
typical mod 512.
a bs=100351 block would need a lot of memory (i don't know
how dd solves that, maybe it starts swapping?)

In the a above line you copy all to the same location
on /dev/rhd10
You missed "seek":
seek=BLOCKS skip BLOCKS obs-sized blocks at start of output
skip=BLOCKS skip BLOCKS ibs-sized blocks at start of input

So line 2 may read:
#dd if=/dev/rhd00 of=/dev/rhd10 bs=512 skip=1539 seek=3000 count=100351 noerror sync
assuming root now ends at 2999 on the new disk.
"noerror sync" is useful if the old disc already contains errors.

But: I don't think it'll work because there maybe absolute informations
stored in the filesystem.

Why don't you divvy the new disc and just mount the new partions
under "root" and let both discs in the server?


or

just dd the root FS,
see if it boots "acceptable"
and delete on the new disk all the dummy/broken FSs
and recreate then with new sizes
add some new FS like "homefs" "tmpfs" "varfs"
and ln -s /homefs/home /home ln -s /tmpfs/tmp /tmp
or -much better-: just mount them und "root"(slash)
(Attention with "usr" "lib" and "etc" ;-) )

Then do a logical copy using "cpio" to be sure that all
permissions and special files are generated correctly.


back to "dd":
It's generally no good idea to make copies of
the disks currently used by the running OS. (I did it very often
had never "real" problems except that the fschk is -of cause-
complaining about a unclean unmount. Of cause done all in single
user mode without any network and deamons! But that is not
recommend for "mission critical" data)

Better:
If you do only "dd" you may want to boot a "Knoppix" CD.
Which is a bootable CD with a "life file system" and a
superb "hardware detection". I assume it will boot any
server hardware which has a x86 processor. (Laptops are a bit difficult)
It contains any tools you need,
For example a tool "partimage" to save entire partion to a second PC
which is running knoppix too.
I assume that your server has a Ethernet card or you can at
least plug one into PCI or USB?

(*)I would -strongly- recommend before playing arround with "dd"
use command line version of "partimage" when booted knoppix
to store the currrent disc on any other PC and try if a restore really works.
Just boot knoppix too and start the "partimaged" on the second box.
You need of cause a DOS or ext3 or reiser or XFS partition
to write to on the second box. A "fresh" disk may do it too.
Knoppix don't need any hard disk if there is 64MB RAM,
all discs are umonuted and all mounts defaults to RO.
So there is no risc for the old data to boot a knoppix CD.



>#divvy
>Name Type New FS # First Block Last Block

>----- ------ --------- ----------- -----------

Jorge_Beteta

unread,
Jun 25, 2003, 6:39:14 PM6/25/03
to
I got the solution thanks to Sppalser. I'll share it with everybody. I
think it's important.

If you wish to copy the whole disk to a second one, first of all you
need to back up any data on your second drive you wish to keep. Next
you will need to unmount your second hard disk filesystem. Then you
will need to redivvy the second hard disk to include the same
filesystems as your "root" disk. Keep your boot and swap slices the
same size then let root have the rest of the disk. However you will
need to name them something other than boot, swap, and root for the
purposes of copying the files. Name them something like "newboot",
"newswap", "newroot". NOTE: The newboot slice must be a filesystem
type of "EAFS", otherwise system will not boot. Use the following to
get into the divvy:

# divvy /dev/rhd1a

Next you will need to comple your file list to be copied. Make sure
you are pathed to root then do the following:

# find . -depth -print > /tmp/file_list

Once your file list is compiled you will need to mount your target
filesystems and create a mount point for your boot filesystem within
the new root. Use the following commands:

# mount /dev/newroot /mnt
# mkdir /mnt/stand
# mount /dev/newboot /mnt/stand

Now you should be ready to copy files. Use the following command
string:

# cat /tmp/file_list | cpio -pdmuv /mnt

This will copy all the files from your smaller source drive to the
larger target drive.

Once the files have been copied you will need to make the target drive
bootable. We do this by writing out a boot loader and rewrite the
master boot record using the following commands:

# dd if=/etc/hdboot0 of=/dev/rhd1a
# dd if=/etc/hdboot1 of=/dev/rhd1a bs=1k seek=1
# dparam -w /dev/rhd10

Unmount your target filesystems:

# umount /mnt/stand
# umount /mnt

Now perform a shutdown and pull out your original drive and re-id your
new boot drive accordingly then reboot your server to the new drive.
Once you are comfortable that everything is working as desired you
could put the old boot drive into the system as a second drive and
re-divvy the drive to give some extra data storage.
Sppalser

0 new messages