Need help with transferring Linux partitions to a new hard disc.
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Need help with transferring Linux partitions to a new hard disc.
I am pretty new to Linux and am need of some guidance/assistance.
I have a machine which has a 250gb hard disc, dual boot Windows XP and Kubuntu 10.10 with the following partitions on it:
Device Boot Start End Blocks Id System
/dev/sda1 * 1 9727 78132096 7 HPFS/NTFS
/dev/sda2 9728 15806 48829567+ 83 Linux
/dev/sda3 15807 30401 117234337+ 5 Extended
/dev/sda5 30039 30401 2915766 82 Linux swap / Solaris
/dev/sda6 15807 17022 9767457 b W95 FAT32
/dev/sda7 17023 30038 104550988+ 83 Linux
The space is becoming critically low and it is being upgraded.
I want to migrate to a 2Tb hard disc but only retain partitions sda2, sda7 and a swap partition. The NTFS and FAT32 Windows partitions sda1 and sda6 are being imaged onto a separate drive for archive purposes (there is data on there we need to retain but it only gets used infrequently).
How best do I achieve the migration from the old drive to the new one?
I thought that if I:
used dd to copy the whole drive to the new disc,
delete the Windows partitions,
resize the Linux partitions,
I might be able to do what I want. Am I correct? If so, what is the best method to do this? Is dd the tool of choice here or there a better method?
Do I need to create new partitions of the required size on the new drive with (for example) gparted before I copy sda2 and sda7 onto them?
Will there be any boot issues on the new disk given that the first partition on the old disc is a Windows partition which will be deleted on the new drive? Do I have to install a new MBR onto the new drive?
Any advice would be welcome. And please advise if I haven't provided enough information.
You can use the Clonzilla live CD to clone your hard drive to the new drive: http://clonezilla.org/ http://clonezilla.org/clonezilla-live.php
I do not know if clonezilla will let you omit the NTFS and FAT partitions when you clone the drive though. You could always just clone the old drive to the new drive, then use a GParted or Parted Magic live CD to delete the partitions you don't want. Then grow the linux partitions into the free space that will be left after deleting the NTFS and FAT partitions. http://partedmagic.com/doku.php
Do not use "dd" - especially don't use it to clone an entire drive.
Personally I always set up the target partitions and filesystems as required and just use "cp -a ..." to copy the partitions one-by-one. Swap you have to "mkswap" on.
Yes it will mess with the boot-loader and fstab, but they are easy fixed - and the end result is better
Last edited by syg00; 02-03-2011 at 10:31 PM.
Reason: missing text
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Since you are changing that much I am not really in favor of cloning and then adapting.
If you are a bit comfortable on the command line, start with a liveCD or liveUSB and partition the new hard disk.
Mount the partitions, and copy the partitions from the old disk to the new one. My preferred tool is rsync. Find out which directories are on the partition you want to copy:
rysnc -auv /olddir /mnt/newpartition
Once the files are copied to the new partions, edit /etc/fstab so it correctly reflects the correct device names. Remember that device names (that is your new hard disk) might change names when booting without the old hard disk.
Finally, install the new mbr with running grub-install while still running on your liveCD. Choose the correct device name where to install grub, that is, the new hard disk.
As an experiment, I first tried the dd and adapting the partitions from there method. It seems to have worked ok. No boot problems, all the partitions required are in place and the correct size, and all files are there. Let's hope I am not missing anything.
The original disc that was replaced is still intact, backed up and I can use it to try the other methods and compare results with the other methods once we buy some more hard discs.
And since the boss wants me to manage the computers here, I foresee lots more questions from me in here as I get up to speed with Linux after my conversion from Windows. I have already found other threads here that have been helpful with other work computer issues in the past couple of months. My Linux experience so far has been of the sink or swim variety and less than three months of it so I am pretty raw.
But I'm certainly seeing the flexibility and power of Linux and am already planning on swapping over on my home computers too.
dd is always the wrong answer for backups - with the exception of backups for forensic examination/recovery.
dd is good at what it does - copy data. It has no facility to handle filesystem errors - it just happily copies them across (unknown) to the target. Filesystem aware tools like cp or rsync will fail if the source is corrupt.
The OP can probably feel some comfort in that the resizing will have (probably) validated the filesystem.