Click to See Complete Forum and Search --> : Can I simply copy all the files from one partition to another
romandas
10-17-2003, 06:37 AM
of an entire Linux installation and expect it to work? I've copied everything over to the new partition except /proc, and I'm not sure what to do next. I don't really want to hose the system.. so I'd like to get this right the first time. Anything else I need to do first?
homey
10-17-2003, 08:25 AM
Leave th old system intact until you are sure the new system works.
You could boot with a rescue cdrom and use cpio
Create the new partitons and make the swap partition of the type 82.
Format the new partitions.
Mount the New and Old partitions on the cdrom /mnt directory.
For example.....
1. mkdir /mnt/old
2. mkdir /mnt/new
3. mount /dev/hda1 /mnt/old
4. mount /dev/hdb1 /mnt/new
5. cd /mnt/old ( change to the lowest directory in that partition. )
6. find . -depth | cpio --pass-through \
--preserve-modification-time \
--make-directories --verbose /mnt/new
Note: that is a period after the " find "
After it is done, edit the bootloader and edit /etc/fstab to point to the new location of the swap partition.
hard candy
10-17-2003, 08:44 AM
Do the following:
1. Make a similar partitioning scheme on the new hard drive
(e.g. /dev/hdb).
2. Use mkswap to create the new swapper.
3. Mount and copy the other file systems. For example:
mount /dev/hdb1 /mnt
cp -ax /* /mnt/
umount /mnt
mount /dev/hdb3 /mnt
cp -ax /boot/* /mnt/
umount /mnt
mount /dev/hdb4 /mnt
cp -ax /home/* /mnt/
umount /mnt
The -ax causes cp to:
not follow symlinks (copy the link as a link -- don't copy the
linked-to file.
preserve original files' ownerships, permissions, etc.
recursively copy subdirectories
*not* recursively copy subdirectories that are mounts of other
filesystems (e.g. proc!)
4. Fix up the new fstab to point to the new partitions.
5. Fix up either lilo.conf or grub.conf (on the new drive). You
may need to look up how to configure whichever of these you are
using. Now comes the tricky part -- you need to install the
lilo/grub boot loader. The simplest way may be to use chroot.
Here is an example for grub:
mount /dev/hdb1 /mnt
mount /dev/hdb3 /mnt/boot
chroot /mnt
grub-install
Both lilo and grub have command line options that do the
equivalent of the chroot for you. I