LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 03-05-2010, 01:00 PM   #1
fkasmani
Member
 
Registered: Dec 2007
Posts: 178

Rep: Reputation: 17
Moving Linux to a new hard drive


Hello, I'm currently using LinuxMint 8 Helena on a 40GB ATA (IDE) hard drive which now seems to be failing. I've got myself a new 160GB SATA drive and would like to move my Linux installation to the new hard drive instead of having to do a fresh installation.

How do I go about with this in the easiest manner?

Thanks in advance for suggestions and help.
 
Old 03-05-2010, 01:10 PM   #2
troop
Member
 
Registered: Feb 2010
Distribution: gentoo, arch, fedora, freebsd
Posts: 379

Rep: Reputation: 96
"dd if=old_drive of=new_drive" in single user mode.
or create new partition table; cp -rdp each of partition; mount new_boot_partition; execute grub-install new_drive.
I would prefer the second option. It is faster and more flexibly

Last edited by troop; 03-05-2010 at 01:21 PM.
 
Old 03-05-2010, 02:11 PM   #3
fkasmani
Member
 
Registered: Dec 2007
Posts: 178

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by troop View Post
"dd if=old_drive of=new_drive" in single user mode.
or create new partition table; cp -rdp each of partition; mount new_boot_partition; execute grub-install new_drive.
I would prefer the second option. It is faster and more flexibly
umm, I don't think I quite understand. should I do this from terminal with both drives connected? will this do the partitioning, setting boot sectors and MBR, etc... and copying everything to the new drive?
 
Old 03-05-2010, 05:56 PM   #4
wabbalee
Member
 
Registered: Oct 2006
Location: brisbane - australia
Distribution: ubuntu
Posts: 335

Rep: Reputation: 38
i havent been here a lot lately, but why dont you try reading a bit more about clonezilla, it will do what you want. but with regards to your partitioning question, i would say it is probably best to make a partition table on your new drive with gparted lived, actually those two pieces of software are good to have in your 'toolbox', i have used them quite a bit myself.

edit:
I even think that clonezilla copies grub accross aswell

Last edited by wabbalee; 03-05-2010 at 05:57 PM.
 
1 members found this post helpful.
Old 03-06-2010, 02:58 AM   #5
fkasmani
Member
 
Registered: Dec 2007
Posts: 178

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by wabbalee View Post
i havent been here a lot lately, but why dont you try reading a bit more about clonezilla, it will do what you want.
Thanks.
I came across PartedMagic while googling for clonezilla and gparted.
Would it have what I need?
 
Old 03-06-2010, 06:47 AM   #6
wabbalee
Member
 
Registered: Oct 2006
Location: brisbane - australia
Distribution: ubuntu
Posts: 335

Rep: Reputation: 38
parted (partition edit) is the back end for gparted which uses a graphical (gtk) front end over parted so we can click our way through. I have no experience with PartedMagic but it sounds like it is an open source equivalent of windows' PQMagic from powerquest. i would say you could use it for your partitioning needs, not for back ups, all judging by the name.
 
1 members found this post helpful.
Old 03-06-2010, 07:15 AM   #7
fkasmani
Member
 
Registered: Dec 2007
Posts: 178

Original Poster
Rep: Reputation: 17
I'm trying to load gparted but it says it can only load in root access - how do i go about with this?
 
Old 03-06-2010, 07:21 AM   #8
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,527

Rep: Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898
In KDE use
Code:
kdesu gparted
In Gnome
Code:
gksudo gparted
 
1 members found this post helpful.
Old 03-06-2010, 05:43 PM   #9
wabbalee
Member
 
Registered: Oct 2006
Location: brisbane - australia
Distribution: ubuntu
Posts: 335

Rep: Reputation: 38
of course what repo says should work, but I just click on it and then it prompts for password which I then type in and voila.. it starts gparted.
 
Old 03-06-2010, 09:08 PM   #10
zrdc28
Member
 
Registered: Dec 2007
Location: Alabama USA
Distribution: Slackware current
Posts: 276

Rep: Reputation: 51
A very simple way to do this is with a program called "copy commander" all you have to do is plug in both drives and then boot from the copy commander disk and it will automatically or manually move everything over. The particians will divided up equally as they are now except extended to fill the whole drive.
 
Old 03-06-2010, 09:13 PM   #11
damgar
Senior Member
 
Registered: Sep 2009
Location: dallas, tx
Distribution: Slackware - current multilib/gsb Arch
Posts: 1,949
Blog Entries: 8

Rep: Reputation: 201Reputation: 201Reputation: 201
I like System Rescue CD and fsarchiver for backup and restore.
 
Old 03-07-2010, 07:24 AM   #12
fkasmani
Member
 
Registered: Dec 2007
Posts: 178

Original Poster
Rep: Reputation: 17
I think I'll go with gparted from the LinuxMint live CD. Does gparted copy & setup the boot sector/MBR in the new drive, and once i complete, will I be just able to disconnect & forget about the old drive and boot straight from the new drive and just continue with my work from where i left?

Also, when setting up the partitions in the new drive, is it possible to set bigger sized partitions as my current (old) drive is a 40GB and the new one is 160GB?

For the record, I've included below the fdisk -l of my current setup:
Quote:
Disk /dev/sda: 40 GB, 40015987200 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 1245 10000431 83 Linux
/dev/sda2 1246 4865 29069617 f Extended LBA
/dev/sda6 1246 1621 3012187 82 Linux swap
Warning: Partition 6 does not end on cylinder boundary.
/dev/sda5 1622 4865 26049397 7 HPFS/NTFS
Warning: Partition 5 does not end on cylinder boundary.

Disk /dev/sdb: 2 GB, 2113896960 bytes
255 heads, 63 sectors/track, 257 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 258 2072353 6 FAT16
Warning: Partition 1 does not end on cylinder boundary.
 
Old 03-07-2010, 07:47 PM   #13
wabbalee
Member
 
Registered: Oct 2006
Location: brisbane - australia
Distribution: ubuntu
Posts: 335

Rep: Reputation: 38
Quote:
I think I'll go with gparted from the LinuxMint live CD. Does gparted copy & setup the boot sector/MBR in the new drive, and once i complete, will I be just able to disconnect & forget about the old drive and boot straight from the new drive and just continue with my work from where i left?
not even with an awful lot of luck, but really, as far as i know with gparted you can set up, move, shrink, flag, format partitions on a hard drive and whatever else i may have forgotten it can do. not copying an image of a drive accross, for that i use clonezilla, as i posted earlier those two are a team and i think a good tool to have. but you need to understand what their specific differences are, one is for partitioning, the other is for back upping and restoring.

now a while back I had some problems with my clones and i posted it here, there is some valuable info in there of troubles that i ran into. i am not too savvy on how to retrieve this thread, so if you or some one else knows how to find specific threads/posts, could you please fill me in a little? and i will find that thread and link it here.

i am not sure if i am doing something wrong, but with regards to your question about making your partitions bigger; my experience is that if i made the target partition too small, clonezilla did not like it. if i made the target bigger, clonezilla would copy the image accross but modified the partition table to the smaller partition in the process. i 'fixed' this in gparted afterwards by resizing it bigger again. i think you need a filesystem check done after this by the os' who's partition you just enlarged/reduced so it knows its new boundaries type of thing.


edit:
what exactly do you want to install on that drive with regards to how many os's and storage?

Last edited by wabbalee; 03-07-2010 at 07:52 PM.
 
Old 03-07-2010, 08:21 PM   #14
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: PocketWriter/MinimalX
Posts: 5,087

Rep: Reputation: 337Reputation: 337Reputation: 337Reputation: 337
Go with remastersys
http://www.geekconnection.org/remastersys/

make a livecd/usb of your system and reinstall to whatever hdd you want
easiest way possible

to make your livecd about 100 or so MB lighter
after remastersys makes the iso,etc
go into /home/remastersys/remastersys and delete the iso it made and the dummysys folder
go into ISOTMP/casper folder and unsquashfs the filesystem.squashfs

Code:
unsquashfs filesystem.squashfs
when its done go into /usr/share and mksquashfs the doc folder

Code:
mksquashfs doc doc.squashfs
now delete the CONTENTS of doc folder, not the doc folder
just whats inside

put doc.squashfs in doc folder


Make sure you use the backup mode and make sure you give your username
when you edit remastersys config
"modify remastersys config" option
then do full backup, not dist mode
"backup complete system including user data"

Now, if you wanna make iso use this script "makeiso.sh" below

Code:
#!/bin/bash
# ---------------------------------------------------
# Script to create bootable ISO in Linux
# usage: ./makeiso.sh
# Put Linux folder's in a folder named "iso"
# Put "iso" folder in a empty folder somewhere
# Name that folder "test"
# Put this script in "test" folder
# Items in "test" folder: iso folder and makeiso.sh
# Example: Put contents of remastersys "ISOTMP"
# folder in test folder with script and invoke
#
# chmod +x makeiso.sh (to make executable)
# invoke script with ./makeiso.sh or just double-click in *buntu
# ---------------------------------------------------

# For mkisofs
echo "Creating new image..."
mkisofs -r -V "ISO-LABEL-HERE" -cache-inodes -J -l \
-b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \
-boot-load-size 4 -boot-info-table -o name_of_iso.iso iso/

# For genisoimage
#echo "Creating new image..."
#genisoimage -r -V "ISO-LABEL-HERE" -cache-inodes -J -l \
#-b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \
#-boot-load-size 4 -boot-info-table -o name_of_iso.iso iso/
You gotta edit for iso label and iso name

iso label part to edit inside qoutes where it says
"ISO-LABEL-HERE"

edit iso name where it says
name_of_iso.iso

remeber to include the .iso

also, you should just put it on usb and its faster install

Dont forget to unsquashfs doc.squashfs after install

Last edited by linus72; 03-07-2010 at 09:43 PM.
 
1 members found this post helpful.
Old 03-08-2010, 01:50 PM   #15
fkasmani
Member
 
Registered: Dec 2007
Posts: 178

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by wabbalee View Post
not even with an awful lot of luck, but really, as far as i know with gparted you can set up, move, shrink, flag, format partitions on a hard drive and whatever else i may have forgotten it can do. not copying an image of a drive accross, for that i use clonezilla, as i posted earlier those two are a team and i think a good tool to have. but you need to understand what their specific differences are, one is for partitioning, the other is for back upping and restoring.
I went to the official clonezilla page and from my understanding, with clonezilla I first need to make an image or backup of my current drive somewhere, then restore that image to my new drive, am I correct - it will not just do a "live" drive to drive copy?


Quote:
Originally Posted by wabbalee View Post
edit:
what exactly do you want to install on that drive with regards to how many os's and storage?
I want the new drive to work exactly like the old one - it's just because the old (current) one is failing and low on space, that I want to get running on a new one.

I found this interesting document about gparted, and it looks as if gparted can do exactly whet I'm looking for - I'm just concerned about the last part where the author has said,
Quote:
ATTENTION PLEASE ! DON'T REBOOT RIGHT NOW !!! If you do this, it will be a big crash! Actually you have the same windows XP on both hard drive. From the second hard drive, XP cant boot, because there is no MBR for the moment ! But if you try to reboot, the first hard drive will run XP and seeing the second XP on the second hard drive, it will be a kind of disaster ! Windows cant bear windows ! So, just turn off the PC, unplug both hard drives, and plug the new one as master, leaving the other one for the moment. Of course, if you use a bootloader like grub, you can configure it to hide/unhide one of the XP you want to
what does he mean by "because there is no MBR for the moment".
After gparted will copy the contents of my current drive to the new drive, the new drive will not be able to boot, until it gets an MBR from somewhere? where??
 
  


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
Moving files from a Linux hard drive to a Windows Vista Premium hard drive WolfMan51 Linux - Hardware 5 07-12-2011 10:19 AM
Moving linux partition from original hard drive to another, howto??? Fear58 Linux - General 22 02-15-2008 05:26 PM
Moving linux to second hard drive rjayaram Linux - General 10 09-11-2003 06:23 PM
Moving linux hard drive to primary slave flyboy320 Linux - General 4 01-23-2002 12:30 PM


All times are GMT -5. The time now is 10:43 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