New (BIG) hard drive - how to move?

Mike Hoskins mikehoskins at yahoo.com
Thu Apr 19 18:51:57 CDT 2001


Actually, a plain, simple cp DOES work, and it works far better than
cpio, tar, and the like.  For one, cpio and tar can/may die at 2G, for
all files, combined!  cp has a 2G per FILE limit, only if your kernel
and/or gnu libraries don't support > 2G files.  cp is also faster, of
course.

dd is actually DANGEROUS; the partition table will not match unless the
drives are exactly the same and your partition tables, which have to be
exactly the same, won't be copied (at the end of the drive, not the
beginning).  BTW, dd only does binary sector-by-sector copies, and is
not designed to copy more than one file.  (dd would be useful in making
drive images, where the two devices are identical HD's.  For example, if
both devices are UNMOUNTED, dd if=/dev/hda of=/dev/hdb bs=512 ...)  Only
use dd where you either have a specific example, or if you're an expert
dd user.  Warning, Will Robinson!  Danger!

cp -a  # This command is equivalent to cp -dpR, see man cp for more
info, preserves ownership, permissions, and special files!
cp -ax # Same as above, only do it to only ONE filesystem

NOTE:  All commands, below, assume a SINGLE mount point for your old
drive -- just /

What I did (not exact devices, etc.) to get LM 7.2 moved from a 4G
Seagate Barracuda SCSI (/dev/sda) to a Maxtor UDMA/100 30G drive
(/dev/hda):
    # login as root
    fdisk /dev/hda    # make a single bootable ext2/reiserfs (hda1) and
a swap device, (hda2) if you like / to hold everything
    init S    # go into single-user mode, that is, if you like file
consistency!  :-0  Same as /sbin/telinit 1
    # you'll have to do the following, per mount point, if you have more
than just / on the new drive
      mkreiserfs /dev/hda1    # replace reiserfs with ext2, for legacy
systems....  :-)  If you have more than one mount point, do them,
too....
      mount -t reiserfs /dev/hda1 /mnt/newdisk    # replace reiserfs
with ext2, for legacy systems....  :-)
      cd /mnt/newdisk    # If you have more than one mount point, do
them, too....
      cp -ax / .    # if everything is on one partition.  If you have
more than one mount point, do them, too....
    vi /mnt/newdisk/etc/lilo.conf    # change all occurrences of
/dev/sda to /dev/hda....
    lilo -C /mnt/newdisk/etc/lilo.conf
    vi /mnt/newdisk/etc/fstab    # change all occurrences of /dev/sda to
/dev/hda....
    cd /
    sync    # I throw this in for free, but it's not really necessary,
if you unmount cleanly
    umount /mnt/newdisk
    shutdown -h now
    power off, if the above step doesn't
    switch your drives around, etc.
    power up with your new config
    (Hey, it all worked great for me!)

The above was based on a lot of man pages, self-discovery, etc.  I later
read this
http://www.linux.org.tw/CLDP/HOWTO/mini/Hard-Disk-Upgrade.html and this
official doc is almost identical, except better.  Mine is merely a
summary of the same info.  Follow it religiously; don't veer to the left
or to the right, as appropriate to you specific system setup.  Your
mileage may vary.  Be careful!  I'm not responsible in any way, if
anything goes wrong, etc....  They add the creation of a boot disk --
strongly recommended!

BTW, I'm actually pretty serious that ext2 is only for legacy systems.
Not trying to start a flame war, but Reiser-FS is a far superior file
system (faster, more reliable JOURNALED filesystem, that can be resized
using LVM), if your kernel supports it!  You can actually upgrade from
ext2 to Reiser-FS and convert, in the above process!  I've been using
Reiser-FS 100%, since Linux-Mandrake 7.2.  Use it, live it, love it.
Reiser-FS is your friend, especially when the power goes off
unexpectedly.  The larger the HD, the longer (exponentially longer) the
fsck at boot time takes, using ext2.  Reiser-FS simply replays a
journal, commits inode chages, and unmounts cleanly upon next boot,
before remounting it; this process takes, at most, a few seconds.  Use
Reiser-FS, if possible.  Dump the ancient ext2.  (I have seen an ext2
fsck actually take over 36 HOURS to come back up!!!!!  I've never seen
Reiser-FS take more than 5 seconds....)

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




More information about the Kclug mailing list