LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Moving Linux to a new hard drive (https://www.linuxquestions.org/questions/linux-newbie-8/moving-linux-to-a-new-hard-drive-793442/)

fkasmani 03-05-2010 12:00 PM

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.

troop 03-05-2010 12:10 PM

"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

fkasmani 03-05-2010 01:11 PM

Quote:

Originally Posted by troop (Post 3887211)
"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?

wabbalee 03-05-2010 04:56 PM

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

fkasmani 03-06-2010 01:58 AM

Quote:

Originally Posted by wabbalee (Post 3887556)
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?

wabbalee 03-06-2010 05:47 AM

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.

fkasmani 03-06-2010 06:15 AM

I'm trying to load gparted but it says it can only load in root access - how do i go about with this?

repo 03-06-2010 06:21 AM

In KDE use
Code:

kdesu gparted
In Gnome
Code:

gksudo gparted

wabbalee 03-06-2010 04:43 PM

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.

zrdc28 03-06-2010 08:08 PM

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.

damgar 03-06-2010 08:13 PM

I like System Rescue CD and fsarchiver for backup and restore.

fkasmani 03-07-2010 06:24 AM

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.

wabbalee 03-07-2010 06:47 PM

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?

linus72 03-07-2010 07:21 PM

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

fkasmani 03-08-2010 12:50 PM

Quote:

Originally Posted by wabbalee (Post 3889635)
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 (Post 3889635)
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??


All times are GMT -5. The time now is 02:55 AM.