LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-26-2009, 02:24 PM   #1
pusrob
Member
 
Registered: Jan 2006
Distribution: Gentoo
Posts: 507

Rep: Reputation: 36
Moving systems and /home to another HDD (my experience)


Hi.

This thread is not a "question" thread, but much more an "answer" thread (for probably asked and maybe for some unasked questions).

Well, in this thread I will write my experience about moving everything (systems (WinXP & Lin) and /home) from one HDD to another. The reason I'm writing this post is because I did this on a laptop, where 2 laptop HDDs cannot be present at the same time. As you know this makes things a bit more complicated.

The situation:
In my laptop there was an old (3,5 years) 40GB PATA HDD and one day I decided to replace it. I bought a 160 GB HDD as a replacement.
Partition table of my drive:
hda1: winxp (NTFS)
hda2: linux (ext3)
hda3: swap
hda4: /home (ext2)

Preparing for system and user data transfer:
Before touching any hardware I did the following:

1. Searched for a partition cloning software.
I found CloneZilla. There are 4 reasons why I chose this: it boots from a CD, supports external drives (USB HDD in my case), supports cloning of NTFS partitions, I can chose if I want to compress the image of the partition or not. This is important, because many other cloning tools don't ask you about compression. Compressing many GBs of data takes much time, and when you only need a quick transfer of data you definately don't want any compression.

2. Searched for a good partitioning live CD for easy and quick partition management on the new HDD. I chose Parted Magic. Any reasons? Well, it has everything I need.

3. Now I opened a root console, (on the "to be cloned system"), mounted the external HDD and copied the whole /home directory to it. The reason I didn't clone it is because the on-disc file order is not important at all on the /home partition, and of course simple copying from disc to disc will defragment my files.
After that I booted to CloneZilla and cloned my WinXP and Linux partitions. I created separate image files for both systems because of security reasons.
NOTE: cloning the entire disc is not an option when transferring systems and data from a smaller HDD to a bigger HDD!! Always clone partitions only!!

Moving data
1. Turned off computer, pulled out AC adapter, removed battery and finally replaced the HDD to the new one.

2. Booted Parted Magic, and created all the previously mentioned partitions.
NOTE No.1: My home is an ext2 partition because this way I have full read-write access to my data from both Windows and Linux. Windows has full access to ext2 with the help of this.
NOTE No.2: If you also want to access an ext2 partition with the mentioned method you have to create the ext2 partition with the inode size of 128 and NOT 256! If it's 256 the windows tool won't mount the ext2 partition!
NOTE No.3: It seems that the latest parted magic (the mke2fs application through gparted) creates an ext2 partition with the inode size of 256 by default. There is no way to change it in gparted, so if you need 128, than you need to create the ext2 partition manually, in the console (using mke2fs of mkfs.ext2). Read the man pages for instructions.
NOTE No.4:parted (not gparted of qtparted!) came handy when I needed to create an empty, not formatted partiton for mke2fs.
NOTE No.5:If you want to put your systems on a bigger partition than they were previously, than you need to know this: Create just a slightly bigger (or the same size as the old one) partition for the systems. Don't forget to keep the necessary empty space after this and before the next partition for later partition growing.
So why you need to do this? Well, because the partition image you created, contains the filesystem too, and when you deploy it to the new place the old filesystem will be written to this new place (with the old size). Writing the old filesystem to the new one will result the old filesystem, despite the true size of the filesystem. To prevent waste of disc space you will need to grow the partition after you deployed the image.

3. Booted CloneZilla again and deployed the partition images to the newly created partitions.

4. Booted Parted Magic again and grew system partitions (see point 2, note no. 5 for reason). Now copied the whole /home folder back to the new and bigger hda4.
NOTE No.1:Don't forget to set the "boot" flag to hda1 (inside gparted), otherwise neither systems will boot!!
NOTE No.2:If you created a different partitioning on your new HDD (the /home is somewhere else now), that don't forget to modify your fstab, otherwise none of your user settings will work. This step is the appropriate time for doing this (after growing of course).

5. Restored GRUB to MBR.


NOTE for the whole "guide(??)": I assume that everybody reads all the man pages and documentations for the mentioned (and not mentioned but related) applications before doing anything.
I take no responsibility for any data loss! (there shouldn't be any with proper background knowledge though).

Have fun!

Last edited by pusrob; 05-26-2009 at 02:29 PM.
 
  


Reply



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
Moving /var or /home to another HDD martinezjr Linux - Hardware 2 09-05-2008 07:52 PM
LXer: CyberLink PowerCinema Linux Delivers Home Entertainment Experience LXer Syndicated Linux News 0 01-23-2006 09:34 AM
Moving root from a dual-boot HDD to a new HDD Androoski SUSE / openSUSE 1 05-13-2005 10:34 PM
Does anyone here have experience with installing two linux systems and one FreeBSD? babyboss Slackware 2 10-23-2004 03:45 AM
moving /var to a new hdd freelinuxcpp Linux - Software 4 11-02-2003 02:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:49 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
Open Source Consulting | Domain Registration