Replacing Hard Disk - Copying Linux system to new Hard Disk ????

Replacing Hard Disk - Copying Linux system to new Hard Disk ????

Post by Frank Sweetse » Fri, 01 Aug 1997 04:00:00




> I apologise in advance because I am sure this question has been asked
> many times.

> I am shortly to install a new HDD and would like to copy my Linux
> system in it's entirity.  Can anyone please give some pointers as how
> to go about this or possibly point me towards a FAQ or Web page which
> has the information.

Simple.

1) create a lilo boot disk with lilo, and the kernel on it (email me if you
   need to know how to do this too)

2) install the new drive in the system, create a filesystem on it, and
   mount it on, say, /mnt

3) copy the filesystem over, making sure to preserve permissions, and
   exclude /mnt and /proc.  Some ways to do this are

cp -a -x / /mnt
        note that the -x means only stay on one filesystem, so if you
        normally have more than one filesystem mounted, you'll need to copy
        those over, too.

( cd / ; tar --atime-preserve -l -p --same-owmer -v -cf - / ) | ( cd /mnt ;
tar --atime-preserve -p --same-owner -xf - )
        but all as one line...

4) after veryfying everything looks good, you can remove the old system,
   reboot off of the boot disk, and re-install lilo on the new disk.

--
Windows: I can play Doom!              |RedHat Linux 2.0.31pre-2 i486
Linux: I can be a file server, be a Web|Because reboots are for upgrades!
server, run the accounting package with|http://www.wpi.edu/~rasmusin/pgp.html
twelve terminals AND play Doom!        |for pgp key.        frank sweetser

 
 
 

Replacing Hard Disk - Copying Linux system to new Hard Disk ????

Post by Yves Bellefeuil » Sat, 02 Aug 1997 04:00:00



> I am shortly to install a new HDD and would like to copy my Linux
> system in it's entirity.  Can anyone please give some pointers as how
> to go about this or possibly point me towards a FAQ or Web page which
> has the information.

I've just moved my entire Linux system from one hard disk to another,
and I was wondering whether this presents enough difficulties that I
should write a Mini How-To. As it is, I've already written something in
Esperanto (!) that I can mail to you if you wish; otherwise, here's a
short explanation in English.

In the following explanation, /dev/hda1 means the "old" Linux partition
and dev/hdb1 means the "new" Linux partition. I'm assuming that Linux is
on the first disk. Modify this as appropriate.

1. Install both disks on your system. Adjust the jumpers as necessary to
make one drive the "master" and the other drive the "slave". Also inform
the BIOS of the drives's "geometry".

2. Format the new drive using "mkfs -t ext2". This is straight-forward.

3. Mount the new disk onto the old disk, using:

        mount -t ext2 /dev/hdb1 /mnt

4. Copy the files from the old disk to the new disk, using a command
similar to this one:

        cp -a /bin /boot /dev /etc /home /lib /root /sbin
              /tmp /usr /var /mnt

This must all be on one line. The last directory, /mnt, is the
destination; all other directories are the sources. You must list all
directories except /mnt as source directories.

5. Modify /mnt/etc/fstab as appropriate for the new disk.

6. The next step is installing LILO on the MBR of the new disk, if this
is your configuration. This is the hardest step. I've concluded that
it's not possible to install LILO directly on the MBR of the new disk
and have it work right the first time; you must use a boot diskette.

Format a diskette using ext2fs and mount it at /mnt. Copy all files in
/boot to /mnt. Make a lilo.conf file as follows:

     boot=/dev/fd0
     map=/mnt/boot.b
     install=/mnt/vmlinuz
     prompt
     image=/mnt/vmlinuz
         label=linux
         root=/dev/hdb1

Run /sbin/lilo to install LILO on the diskette. The location of the
lilo.conf file you just made can be specified using the -C switch.

7. Remove the old disk. Modify the jumpers and the BIOS information as
appropriate for your new disk. Boot the system from the diskette you
just made. Modify /etc/lilo.conf on the new disk and run /sbin/lilo to
install LILO on the MBR of the new disk.

I'd be interested in hearing from any other users who've had trouble
moving Linux fron one hard disk to another and think it would be useful
to have a more complete Mini How-To.

--
Yves Bellefeuille
Ottawa, Canada

Francais / English / Esperanto

 
 
 

Replacing Hard Disk - Copying Linux system to new Hard Disk ????

Post by Yves Bellefeuil » Mon, 04 Aug 1997 04:00:00


I recently posted an article on how to transfer a Linux system from one
hard disk to another. Somehow, part of the text got completely garbled.

I said that one should use a boot floppy to boot the system the first
time after installing the new disk. The lilo.conf file I suggested was
seriously wrong.

I'm calling the old hard disk /dev/hda, and the new hard disk /dev/hdb.
I'm assuming that the floppy is mounted at /mnt, and that the contents
of /boot has been copied to /mnt.

Here's the correct lilo.conf file to install LILO on the boot diskette:

boot=/dev/fd0             # Install LILO on floppy disk.
map=/mnt/map              # Location of "map file".
install=/mnt/boot.b       # File to copy to floppy's boot sector.
prompt                    # Have LILO show "LILO:" prompt.
image=/mnt/vmlinuz        # Location of Linux kernel on floppy.
    label=linux           # Label of linux system.
    root=/dev/hdb1        # Location of root partition on new hard disk.
                          # Note that we use the name of the present
                          # location, with both disks installed,
                          # and not the name of the future location,
                          # once the old disk is removed.

Save this file, for example at /mnt/lilo.conf, then run
/sbin/lilo to install LILO on the floppy disk:

    /sbin/lilo -C /mnt/lilo.conf

The -C option shows the location of the configuration file.

Sorry for any inconvenience the error caused.

--
Yves Bellefeuille
Ottawa, Canada

Francais / English / Esperanto

 
 
 

1. can we copy an installed Linux on a hard disk onto another hard disk

Yes, I have been beating this around all day doing repairs to a crashed (lost
a drive) system.......
try
mount </dev/blah> /mnt
find / -xdev -depth -print|cpio -pdmv /mnt

sean
--
http://www.Northwest.com/index.html  Home of the Portland Linux Users Group
              The mom and pop corner store of the internet...
                503-777-4034 log on to new for an account
$30.00/6 month $50.00/year for shell $45.00/quarter $150.00/year SLIP/PPP

2. talk & slackware 2.2.0

3. New hard disk - How to copy existing system over?

4. LILO fails to boot old OS - more details. Please advise!

5. How to lock the bad sectors on the hard disk without reformatting the hard disk !!??

6. Large IDE disk, old BIOS, fdisk complains, ...HELP!

7. Ultra 5 IDE hard disks - can I use any PC hard disk?

8. Chameleon-->Linux-->INet

9. Hard disk upgrade - how to get everything (linux/Windows95) on new disk

10. how to copy boot disk to hard disk

11. How do I copy a file from floopy disk to hard disk?

12. New Hard Disk To My LINUX SYSTEM

13. Can one do disk-to-disk copys with Sun hard disks?