Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 03-23-2010, 11:52 AM   #1
LQ Newbie
Registered: Oct 2004
Location: Texas
Distribution: Redhat 9, Fedora Core 2, and RHEL 3.0
Posts: 3

Rep: Reputation: 0
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.
Old 03-23-2010, 12:02 PM   #2
Registered: May 2004
Location: Amsterdam, Holland
Distribution: Ubuntu, Redhat, Angstrom (others in the past)
Posts: 34

Rep: Reputation: 22
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.

Last edited by bertl; 03-23-2010 at 12:03 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hard Drive Partition Management - Mandriva Double Partition with Swap File partition moshebagelfresser Linux - Hardware 2 05-23-2008 10:46 AM
Copying files from internal Hard drive to USB 2.0 Hard Drive is NOT Behaving tubatodd Ubuntu 4 02-19-2007 04:32 PM
Copying one hard drive to a partition and having it bootable... how? Nebetsu Linux - Hardware 24 01-02-2006 01:07 PM
Best way to partition my hard drive QzarBaron Linux - General 6 06-23-2004 02:49 AM
What is best way to partition you hard drive? sunday2 Linux - Hardware 4 05-16-2004 05:24 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:49 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration