LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Transfering partitions and dual boot grub to a bigger hard disc (https://www.linuxquestions.org/questions/debian-26/transfering-partitions-and-dual-boot-grub-to-a-bigger-hard-disc-745246/)

glore2002 08-05-2009 05:28 AM

Transfering partitions and dual boot grub to a bigger hard disc
 
Hello!

I am planning to get a new hard disc which will be bigger than the one I am using right now. My disc is 160Gb and I would like to get a 320Gb or 500Gb disc.

My dual boot system has the following partitions:

# fdisk -l
======================================================================
/dev/sda1 * 1 8924 71681998+ 7 HPFS/NTFS
/dev/sda2 8925 9185 2096482+ 82 Linux swap / Solaris
/dev/sda3 9186 11735 20482875 83 Linux
/dev/sda4 11736 19457 62026965 5 Extendida
/dev/sda5 11736 14285 20482843+ b W95 FAT32
/dev/sda6 14286 19457 41544058+ 83 Linux
======================================================================

fstab is:

======================================================================
proc /proc proc defaults 0 0
/dev/sda3 / ext3 errors=remount-ro 0 1
/dev/sda6 /home ext3 defaults 0 2
/dev/sda2 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/sda1 /media/windows ntfs-3g defaults 0 0
/dev/sda5 /media/fat32 vfat defaults,users,umask=000 0 0
======================================================================
So:
sda1 is a NTFS partition 68.36Gb (winxp)
sda2 is a SWAP partition with 2Gb.
sda3 is an ext3 partition (/) with 19.53Gb.
sda4 is an extended partition with 2 logical units (those that follow)
sda5 is a windows FAT32 partition with 19.53Gb.
sda6 is an ext3 partition (/home) with 39.62Gb.

I am using Debian Lenny 64 bits Linux distribution.

To make it clear: What I want is to move everything from my 160Gb sata drive to a bigger one taking advantage of the new size (to resize partitions). Of course, the two discs have different geometry. Everything should work OK as it is working right now on the old disc. Dual boot system with Grub bootloader (this is what I expect :-)

Should I copy partitions and MBR or the whole disc at once?

I found this somewhere in another forum (unix forum). It is used to copy the MBR. Should I do this and copy the partitions with clonezilla? What about Grub and the partition table.

=======================================================================
:
To backup the MBR you

dd if=/dev/sda of=mbrbackup bs=512 count=1

to restore the MBR you want to

dd if=mbrbackup of=/dev/sdb bs=446 count=1

If you copy more than 446 you will wipe over the partition tables, which is OK if you are copying to the same disk with the same unchanged partitions.
========================================================================

Sorry for the lenght of this post but I wanted to be as clear as possible.

Thanks in advance for your help!
Glore2002.-

tommcd 08-05-2009 06:49 AM

Quote:

Originally Posted by glore2002 (Post 3632051)
I found this somewhere in another forum (unix forum). It is used to copy the MBR. Should I do this and copy the partitions with clonezilla? What about Grub and the partition table.

You may want to try a Parted Magic live CD:
http://partedmagic.com/
Parted Magic now comes with Clonezilla. I have used Parted Magic to re-partition my hard drives, but I have not used Clonezilla. The Parted Magic live CD with Clonezilla should be able to do what you want to do though.

glore2002 08-05-2009 10:30 AM

Thanks Tommcd for your suggestion!

Once in parted magic What steps should I follow to copy partitions (win and linux) to the new drive, resize them and making Grub work as well?

I can start by creating images of the partitions with Clonezilla. What's next?

Thanks again for your cooperation.
Glore2002.-

tommcd 08-06-2009 03:09 AM

Quote:

Originally Posted by glore2002 (Post 3632410)
Once in parted magic What steps should I follow to copy partitions (win and linux) to the new drive, resize them and making Grub work as well?

I can start by creating images of the partitions with Clonezilla. What's next?

I have not actually used Clonezilla. I have been using Parted Magic for some time though to partition or resize hard drives. The Parted Magic live CD now comes with the Clonezilla command line partition tool. Here is a video that explains how to use it:
http://www.jupiterbroadcasting.com/?p=567
You may want to try a Clonezilla live CD, which you can get here:
http://clonezilla.org/clonezilla-live/doc/
and the documentation for the Clonezilla live CD is here:
http://clonezilla.org/clonezilla-live/doc/
For grub, I would think that if Clonezilla copies the MBR to the new hard drive, then it should boot just the same as the old drive. If it does not, then you can always restore grub to the MBR like this (example is from Ubuntu live CD):
http://ubuntuforums.org/showthread.p...highlight=fsck

glore2002 08-07-2009 05:35 AM

Thanks again!
This weekend, I am planning to buy the new HD and then I will tell you what happened. I will also ask for help if, while transfering the system- any problem appears :-)

Thanks,
Glore2002.-

glore2002 08-09-2009 11:51 AM

Finally, I moved my system.
 
First of all, thanks for your help!

I've finally moved my system. How? I made the following steps.

#1) I boot my system with Parted Magig 4.3 (usb version - Pendrive).
#2) I've used Clonezilla to copy the entire 160Gb old disc to the new 500Gb disc. Clonezilla uses partclone to copy partitions. My system had a NTFS partition, two ext3 partitions (/ and /home), SWAP partition and a 20Gb FAT32 partition. Clonezilla asks for copying also MBR (bs=446) to the new disc. I've answered "YES".
#3) After copying discs, I booted up my computer with the new disc. It worked! Grub included. I must recognize, I didn't expect Grub working but it did!
#4) The only partition with some problems (many fsk...files) was FAT32 partition. It wasn't big deal because I re-formatted the partition and copied everything back from the old disc. So, as a conclusion, I can say FAT32 partitions are not the best ones to keep important things.
#5) The rest of the partitions were OK. Then I could boot again in Debian or win using Grub as the bootloader.
#6) The results were the same partitions as the old disc plus an unpartitioned section of the new disc.
#7) I've resized the extended partition and I've also created two new partitions for backup purposes. A new ext3 partition (/backup) and a NTFS partition (winbackup). I've added them in fstab and gave them access permissions with chmod 777.

Now, my system is working and I feel happy with the results. Thanks for all your help and patience.

I recommend Parted Magic and Clonezilla as partition and backup tools.


Thanks again,

Glore2002.-


All times are GMT -5. The time now is 12:24 AM.