Need to COPY my Linux installation to larger drive

Asked by Ray Edester

My present drive is inadequte in size for the present partitions/OS'. I have a larger HD which I will partition for the OS' I have installed.

  My question is how to do the transfer of Ubuntu to the new HD? I have been using Ubuntu too long to want to start from scratch..... I don't trust DD for fear it will truncate the new drive/partition. And, I don't know if CP will do the job and preserve the integrity of the file system. ???

I'm sure this problem has been experienced by someone....

Any help will be appreciated.

Tks,

Ray

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Ray Edester
Solved:
Last query:
Last reply:
Revision history for this message
Bryce Harrington (bryce) said :
#1

Hi Ray,

The good news is that there's a number of ways you can do this.

The easiest is if you are going to keep both drives in the system. In this case, you can leave the system stuff on the original drive and move some of the larger space users (typically /var and /home) to the new drive, and you're done.

But let's assume you have other plans for the old hard drive. Moving the files from the old drive to the new is straightforward. You can do this using 'cp -a -v', which preserves timestamps on files, FIFOs, and otherwise correctly handles other system files. The -v means verbose, so it'll give you some progress info as it copies.

If you are manually partitioning the new drive, make sure that your /boot partition is marked bootable.

Also, doublecheck that the partitions on the old drive are Linux type 83 (or swap, type 82). If they're some other type, a different approach may be needed.

Next, go ahead and copy over the data for each partition, using cp -av.

Now, one thing you'll need to doublecheck is the drive name. If the old drive and the new drive are either both IDE or both SCSI or both SATA, then you don't need to do this. However, if the old drive is IDE and the new one is SCSI or SATA (or vice versa), then you'll need to switch /dev/hda to /dev/sda in the file /etc/fstab.

Finally, you'll need to install grub onto the new harddrive. You can find information about this online. This may require some study and experimentation to get right.

To test the drive, what I would suggest is to unplug the old drive and try booting up the computer. If it doesn't boot, then reconnect the old drive, reboot, and troubleshoot.

Good luck, and report back if you get stuck.

Bryce

Revision history for this message
Ray Edester (ray-edester) said :
#2

Hello Bryce,

Thank you for the help.

I will keep the old drive off-line ('Never burn my bridges! :-))

I have 4 partitions;
1. DR-DOS
2. Windoze XP
3. Linux Swap
4. Ubuntu Linux

Also, HDB for an "Archive" disk.

Filesystem 1K-blocks Used Available Use% Mounted on

/dev/hda4 38266476 4054712 32267900 12% / Linux
/dev/hda1 2096160 190208 1905952 10% /media/hda1 Dr-DOS
/dev/hda2 36908320 30003424 6904896 82% /media/hda2
   WinXp.... The Main concern is this Hog!

This is on an eighty Gig HD and will be replaced by a two hundred Gigger.
I'll probably give DOS only a gig, Linux, 50 Gigs, a 512 Meg swap and the
remainder to the HOG. I have been doing Movie work there and it eats HD
real estate like there is no end!

On Wednesday 14 February 2007 18:40, Bryce Harrington wrote:
> Your support request #3699 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+ticket/3699
>
> Status: Open => Answered
>
> Bryce Harrington proposed the following answer:
> Hi Ray,
>
> The good news is that there's a number of ways you can do this.
>
> The easiest is if you are going to keep both drives in the system. In
> this case, you can leave the system stuff on the original drive and move
> some of the larger space users (typically /var and /home) to the new
> drive, and you're done.
>
> But let's assume you have other plans for the old hard drive. Moving
> the files from the old drive to the new is straightforward. You can do
> this using 'cp -a -v', which preserves timestamps on files, FIFOs, and
> otherwise correctly handles other system files. The -v means verbose,
> so it'll give you some progress info as it copies.
>
? Is the option -R not also required for the CP command?

> If you are manually partitioning the new drive, make sure that your
> /boot partition is marked bootable.
>
> Also, doublecheck that the partitions on the old drive are Linux type 83
> (or swap, type 82). If they're some other type, a different approach
> may be needed.
>
That's the easy part! :-)

> Next, go ahead and copy over the data for each partition, using cp -av.
>
> Now, one thing you'll need to doublecheck is the drive name. If the old
> drive and the new drive are either both IDE or both SCSI or both SATA,
> then you don't need to do this. However, if the old drive is IDE and
> the new one is SCSI or SATA (or vice versa), then you'll need to switch
> /dev/hda to /dev/sda in the file /etc/fstab.
>
Another easy one... Both are Seagate IDE.

> Finally, you'll need to install grub onto the new harddrive. You can
> find information about this online. This may require some study and
> experimentation to get right.
>
I *think* I have GRUB on a rescue floppy with enough info to do this.... I
can lean on a "seasoned" linux friend for some help there whenever I get
that far. I might do that before CP'ing to HDA1 and HDA2 to see how it
plays that far.....

> To test the drive, what I would suggest is to unplug the old drive and
> try booting up the computer. If it doesn't boot, then reconnect the old
> drive, reboot, and troubleshoot.
>
> Good luck, and report back if you get stuck.
>
> Bryce
>
Sure will and thanks again,

Ray

> _______________________________________________________________________
> If this answers your request, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/ubuntu/+ticket/3699/+confirm?answer_id=0
>
> If you still need support, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/ubuntu/+ticket/3699

Revision history for this message
Bryce Harrington (bryce) said :
#3

Sounds good, and what I described should do the trick for the Linux partitions.

I'm not sure that cp -a would work properly on the Windows XP partition; I haven't done Windows in years. Could be worth a shot, but I bet you'd want to dd (or maybe cpio) that one.

Let us know how it goes! :-)

Bryce

Revision history for this message
Alan Pope 🍺🐧🐱 🦄 (popey) said :
#4

The following web page details pretty much what exactly what you're after, with examples:-

http://www.hants.lug.org.uk/cgi-bin/wiki.pl?LinuxHints/OneDiskToAnother

Revision history for this message
Ray Edester (ray-edester) said :
#5

Hello Alan,

Thank you for the input to my needs.

There is certainly a lot of reading/UNDERSTANDING to be done before
venturing onto my project!

Ray

On Thursday 15 February 2007 05:39, Alan Pope wrote:
> Your support request #3699 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+ticket/3699
>
> Alan Pope proposed the following answer:
> The following web page details pretty much what exactly what you're
> after, with examples:-
>
> http://www.hants.lug.org.uk/cgi-bin/wiki.pl?LinuxHints/OneDiskToAnother
>
> _______________________________________________________________________
> If this answers your request, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/ubuntu/+ticket/3699/+confirm?answer_id=3
>
> If you still need support, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/ubuntu/+ticket/3699

Revision history for this message
Best Ray Edester (ray-edester) said :
#6

Hello All,

I have solved my problem by "Cloning" my 80 GB HD to a 200 GB HD using Acronis,Com's programs, "migrate Easy", to copy the partitions and "Disk Director" to do a resizing and and further cleanup.

I now have partitions of; 1 GB DR-DOS, ~ 150 GB WinXP, 40 GB of Linux and a Swap partition on the 200 GB drive and the 80 GB drive put away for insurance!

The mentioned programs are for windows. But, they are the best I have seen and certainly got my problem of exchanging drive sizes.

Thanks,

Ray