LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices


Reply
  Search this Thread
Old 02-03-2011, 09:07 PM   #1
JoeAquilina
LQ Newbie
 
Registered: Dec 2010
Posts: 2

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

Joe.
 
Old 02-03-2011, 09:37 PM   #2
tommcd
Senior Member
 
Registered: Jun 2006
Location: Philadelphia PA USA
Distribution: Lubuntu, Slackware
Posts: 2,230

Rep: Reputation: 291Reputation: 291Reputation: 291
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
 
1 members found this post helpful.
Old 02-03-2011, 10:16 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,838

Rep: Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822
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
 
Old 02-03-2011, 10:17 PM   #4
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,493

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

jlinkels
 
Old 02-04-2011, 02:09 AM   #5
JoeAquilina
LQ Newbie
 
Registered: Dec 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks for the advice.

Thanks for the advice folks.

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.

Thanks again all.

Cheers.

Joe.
 
Old 02-04-2011, 02:56 AM   #6
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,672
Blog Entries: 29

Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
Quote:
Originally Posted by syg00 View Post
Do not use "dd" - especially don't use it to clone an entire drive.
I need some enlightenment, by cloning the entire drive did you mean creating a backup of the OS or whatever is there on the drive?
I was recently advised to use dd here: http://www.linuxquestions.org/questi...intact-859419/

Is using dd wrong in the context of the above thread?
 
Old 02-04-2011, 03:28 AM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,838

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

... or not.
 
1 members found this post helpful.
Old 02-04-2011, 03:31 AM   #8
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,672
Blog Entries: 29

Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
Quote:
Originally Posted by syg00 View Post
dd is always the wrong answer for backups - with the exception of backups for forensic examination/recovery.
I am lost now! So what is the right command for backing up the entire OS, the file systems etc. every thing on the harddisk, I mean? Any hints would do.
 
Old 02-04-2011, 04:02 AM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,838

Rep: Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822
This gets discussed all the time. My opinions are not universally accepted BTW.

I like things like fsarchiver - it validates the data for me. On the backup.
Likewise dvdisaster.

There is no replacement for data validation.
End of discussion.
 
1 members found this post helpful.
Old 02-04-2011, 04:15 AM   #10
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,672
Blog Entries: 29

Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
Quote:
Originally Posted by syg00 View Post
I like things like fsarchiver - it validates the data for me.
:relief: Thank you for this post. fsarchiver looks promising.

Quote:
Originally Posted by syg00 View Post
There is no replacement for data validation. End of discussion.
I never knew that dd blindly copies things out. Perhaps I should have searched Google for cons of dd.

Thanks a ton, again.
 
Old 02-04-2011, 08:13 AM   #11
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,541
Blog Entries: 23

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Hi,

Quote:
Originally Posted by Anisha Kaul View Post
<snip>
I never knew that dd blindly copies things out. Perhaps I should have searched Google for cons of dd.

Thanks a ton, again.
Look at 'Learn The DD Command Revised' Thread created by LQ member AwesomeMachine. You will find loads of helpful information.

As to the pro/con of 'dd', loads of arguments and valid points to use and not use. 'dd' is very useful tool in the right hands and used when appropriate.
 
1 members found this post helpful.
Old 02-04-2011, 09:17 AM   #12
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,672
Blog Entries: 29

Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
Thanks, I will.
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Transfering partitions and dual boot grub to a bigger hard disc glore2002 Debian 5 08-09-2009 12:51 PM
Transferring my Debian to new hard drive and merging partitions seish Linux - Newbie 1 05-01-2008 03:19 PM
transferring linux to an external hard drive martha123 Linux - Newbie 1 09-21-2005 10:48 AM
Server Hard-disc partitions. MeddlePAL Linux - General 1 06-26-2004 10:59 PM
Error occured while transferring images to hard drive linux 7.1 chandra Linux - Software 1 03-12-2002 03:22 AM


All times are GMT -5. The time now is 10:57 AM.

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