TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to GHOST a drive in Linux...
I did something very similar to what you're trying WITHOUT using dd or tar...
I had purchased a new drive for the server and wanted to move some of the
directory trees to the new paritions, namely /var, /home, and /tmp (which I
didn't copy over...go figure).
In the sequence of events:
1. Partition the new harddrive.
2. Format the new harddrive with an ext2 or desired file system
(Nice, because you can use any system you want.)
3. Make sure you have a backup of your current harddrive (if
you have the ability to back it up).
4. Create mount points in /tmp for the new partitions:
/tmp/home
/tmp/var
And now for the magic:
5. At your root prompt:
# cd /home
# find . -mount -print | cpio -p -v /tmp/home
# cd /var
# find . -mount -print | cpio -p -v /tmp/var
6. Verify that everything copied over well w/ramdom file checks:
Content, permissions, etc...
7. Edit your /etc/fsck file to mount the new disk partitions at the
appropriate mount points.
8. The scary part (needed only if you moved a directory tree that
didn't have a partition of its own originally). Delete the
files from the original directory trees that you copied over:
# rm -rf /home/.*
# rm -rf /home/*
# rm -rf /var/.*
# rm -rf /var/*
10. Unmount the partitions from the /tmp directory and remount them on
the root tree:
# umount /tmp/home
# umount /tmp/var
# mount -t ext2 /dev/hdb2 /home
# mount -t ext2 /dev/hdb3 /var
11. Done.
You could apply this same technique to copy one harddrive to another. You
could even rsh this, or perhaps use an NFS mount to a rescue boot of Linux to
reformat the harddrive.
--
^chewie
PGP signature