Copying a partition from one hard drive to the same partition on another hard drive
I am trying to move a whole bunch of files from one partition on one hard drive to the same partition on another hard drive. Can I mount the same partition (same name, different drives, i.e. /data on /dev/hda1 and /data on /dev/hdb1)and copy those files? Shutdown the server, take out /dev/hda1 and boot up with the new drive and it's /data contents. Thanks.
|
Well not completely, you can't mount them both at the same time in the same location. Ater you've gotten rid of the old drive/partition you can of course mount the new one there instead.
I tend to do something like umount /data mkdir /mnt/src mount -oro /dev/oldpart /mnt/src mkdir /mnt/dst mount /dev/newpart /mnt/dst cp -a /mnt/src/* /mnt/dst umount /mnt/dst umount /mnt/src mount /dev/newpart /data Make sure there's a filesystem on the partition on the new drive (e.g. mkfs -j /dev/newpart). If it's just a /data you don't need to do much more (well, edit /etc/fstab so it gets auto mounted at startup). If you also plan to move your boot/root partition(s) there you also need to install a boot block on the new disk, with grub or such. |
All times are GMT -5. The time now is 12:11 AM. |