Re: Making a bootable second hard disk (and larger filesystems)

From: Jorge_Beteta (jbeteta_at_yahoo.com)
Date: 06/26/03


Date: 25 Jun 2003 15:39:14 -0700

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



Relevant Pages

  • SUMMARY: Moving /usr From Under Root "/" To Its Own Partition
    ... One of the reasons for doing this is to end up with a smaller root ... Install the boot block and boot off the new drive. ... " In order for the root partition to be fscked and remounted ... D> temporarily on the existing disk. ...
    (SunManagers)
  • Strange case of root filesystem corruption
    ... Yesterday GRUB would suddenly not display the boot menu anymore. ... Looking at filesystems on the disk with the free ufs2tools program, ... Subfolders of / on the same filesystem are affected as well. ... sectors/track: 63 ...
    (freebsd-questions)
  • Re: fsckd - FIXED
    ... filesystem errors on boot, with the "hit control-D to continue or give root ... to fix the errors with fsck. ... filesystem and inability to reboot. ...
    (Debian-User)
  • Strange case of root filesystem corruption
    ... Yesterday GRUB would suddenly not display the boot menu anymore. ... Subfolders of / on the same filesystem are affected as well. ... The disk is a Seagate IDE drive. ... sectors/track: 63 ...
    (freebsd-stable)
  • Re: fsckd
    ... filesystem errors on boot, with the "hit control-D to continue or give root ... to fix the errors with fsck. ... filesystem and inability to reboot. ...
    (Debian-User)