This is my method of doing it, many other ways will exist, but this works.
OK, so you bought a new hd for your computer. This method is primarily for laptop users who cannot easily plug another HD into the system.
First of all, you will need 3 things.
A cd with system rescue cd
a cd with Super Grub Disc
A USB enclosure (or other method to use the new HD)
The 2 cd's are two things that no computer user should ever be without in my opinion, small and handy, live on a USB key or a mini cd, small and you can fix most stuff.
First things first, boot up the comp with the system rescue cd, select your keymap and when it finishes loading type 'startx' this will brink up the GUI. It may be useful to fsck the original drive at this point to check for any errors.
Now plug in your new HD in the USB caddy, wait a moment and then run gparted.
For simplicity I just continued the partitioning system I had before on my laptop which is
/dev/hda1 - windoze (yes I know, but I like guildwars and it don't like my ATI card on wine)
/dev/hda2 - /boot (ext3 as I use XFS and grub is not too friendly with XFS)
/dev/hda5 - / (XFS the root filesystem)
/dev/hda6 - /home (XFS, all my stuff)
/dev/hda4 - /swap (at the end of the drive where it will be fastest)
hda 5 and 6 are in an extended partition. As I am running kubuntu updated over several releases my HD's are referred to in kubuntu as hdx rather than the newer sdx.
So assuming you are just partitioning along the same lines set up the partitions in gparted on your new drive. You can re-lay them out if you want, but I shall not be going into that in any detail. Also pay attention to the flags, on my system, only the windows partition is flagged 'boot'
Now it's set up, open a terminal and type, assuming sdb is your new drive running in a USB caddy.
This will stick a main boot record on the disc.
Now you need to create directories to mount the old and new partitions. so for my root partition I opened a terminal and issued the following commands.
Now you are ready to copy the drive contents over using rsync
-a will preserve file permissions and all symlinks, -v is verbose and will show you what file is being copied to give you something to look at as it can take a LOOOoooooonnnnggggg time (3 hours to copy over all mine, about 74 GB of data)
Repeat for all partitions, like /mnt/home and /mnt/homeb /mnt/windows, /mnt/windowsb. While copying over large drives go make a coffee, watch a film or something.
If you get an error when it has completed, issue the rsync command again, this will try again, should only take a few seconds and show you any files it could not copy due to any disc errors, hopefully nothing important. rsync is really used for incremental backups of filesytems, but is useful in this case.
Once it is all over with the copying, you now need to get the UUIDs of the new drive. For this the command 'blkid' is used. This is an important bit!!
It is advisable to open a terminal just for this and keep it on the desktop
Next open Leafpad (an editor) and open the file /mnt/bootb/grub/menu.lst (or /mnt/rootb/boot/grub/menu.lst is you do not have a separate boot partition) and replace the UUID with the UUID for the new disc. Save and close.
Open leafpad again and open /mnt/rootb/etc/fstab. Again replace all the drive UUIDs with the ones from the new drive.
It is essential you take great care with this. you can copy and paste from the terminal to leafpad so no need to be referring back and forth. This is so Kubuntu knows where to find its drives.
Exit the GUI and press ctrl-alt-delete or type 'shutdown -h now' in the sysresccd console, remove the cd. Turn off the comp.
Now get your screwdrivers out, make sure no cats are around and swap the drives over, or just stick the new one in and chuck the old one, though it's handy to use it as an external HD, or a good start for incremental backups of the system, personally i don;t care what you do with it, it os yours after all, but your hopefully finished with it.
Now boot up the comp as a check, it should just boot up into windows if it is duel boot (or not at all if you have no windows.) Close down windows, for it is the spawn of Satan and must be crushed into the ground. It will be asking you to reboot for the new HD anyway, or wanting you to renew the license. God I hate windows.
OK, slip in the Super Grub Cd and boot from it. It is straight forward and will detect and menu.lst on your system and allow you to boot into Kubuntu. Boot at normal. Now you need to install Grub on the MBR. Open a Konsole and simply type.
or
if you are using a newer version of Kubuntu that uses sdx
Now reboot the system, your grub should be there. Congratulations you have a new bigger hard drive and your old system back.
OK, so you bought a new hd for your computer. This method is primarily for laptop users who cannot easily plug another HD into the system.
First of all, you will need 3 things.
A cd with system rescue cd
a cd with Super Grub Disc
A USB enclosure (or other method to use the new HD)
The 2 cd's are two things that no computer user should ever be without in my opinion, small and handy, live on a USB key or a mini cd, small and you can fix most stuff.
First things first, boot up the comp with the system rescue cd, select your keymap and when it finishes loading type 'startx' this will brink up the GUI. It may be useful to fsck the original drive at this point to check for any errors.
Now plug in your new HD in the USB caddy, wait a moment and then run gparted.
For simplicity I just continued the partitioning system I had before on my laptop which is
/dev/hda1 - windoze (yes I know, but I like guildwars and it don't like my ATI card on wine)
/dev/hda2 - /boot (ext3 as I use XFS and grub is not too friendly with XFS)
/dev/hda5 - / (XFS the root filesystem)
/dev/hda6 - /home (XFS, all my stuff)
/dev/hda4 - /swap (at the end of the drive where it will be fastest)
hda 5 and 6 are in an extended partition. As I am running kubuntu updated over several releases my HD's are referred to in kubuntu as hdx rather than the newer sdx.
So assuming you are just partitioning along the same lines set up the partitions in gparted on your new drive. You can re-lay them out if you want, but I shall not be going into that in any detail. Also pay attention to the flags, on my system, only the windows partition is flagged 'boot'
Now it's set up, open a terminal and type, assuming sdb is your new drive running in a USB caddy.
Code:
install-mbr /dev/sdb
Now you need to create directories to mount the old and new partitions. so for my root partition I opened a terminal and issued the following commands.
Code:
cd /mnt mkdir root mkdir rootb mount /dev/sda5 /mnt/root mount /dev/sdb5 /mnt/rootb
Code:
rsync -a -v /mnt/root/ /mnt/rootb/
Repeat for all partitions, like /mnt/home and /mnt/homeb /mnt/windows, /mnt/windowsb. While copying over large drives go make a coffee, watch a film or something.
If you get an error when it has completed, issue the rsync command again, this will try again, should only take a few seconds and show you any files it could not copy due to any disc errors, hopefully nothing important. rsync is really used for incremental backups of filesytems, but is useful in this case.
Once it is all over with the copying, you now need to get the UUIDs of the new drive. For this the command 'blkid' is used. This is an important bit!!
Code:
$ blkid /dev/sda1: UUID="6E56F8A244C73D5E" TYPE="ntfs" /dev/sda2: UUID="e24305a0-9495-48d8-9a5d-f93cec786c67" SEC_TYPE="ext2" TYPE="ext3" /dev/sda4: TYPE="swap" UUID="d37c952c-20f8-4e9d-93c2-d63d58b5aa57" /dev/sda5: UUID="e81a3006-00f6-4fd2-9246-4bd996ec3324" TYPE="xfs" /dev/sda6: UUID="42c2cedd-c00f-4bd0-a066-97529d312ccf" TYPE="xfs" /dev/sdb1: UUID="9A38DF6D38DF46C3" TYPE="ntfs" /dev/sdb2: UUID="9c933e66-95c9-455c-8ce8-b90c058b2a93" SEC_TYPE="ext2" TYPE="ext3" /dev/sdb4: UUID="4e7ab7a2-cfd8-4d11-a0ca-3d901731ec19" TYPE="swap" /dev/sdb5: UUID="a6817feb-9883-4a7d-86d9-8a9c70d810d9" TYPE="xfs" /dev/sdb6: UUID="27554223-4110-4c29-be9a-ebbf18b6f2fd" TYPE="xfs"
Next open Leafpad (an editor) and open the file /mnt/bootb/grub/menu.lst (or /mnt/rootb/boot/grub/menu.lst is you do not have a separate boot partition) and replace the UUID with the UUID for the new disc. Save and close.
Open leafpad again and open /mnt/rootb/etc/fstab. Again replace all the drive UUIDs with the ones from the new drive.
It is essential you take great care with this. you can copy and paste from the terminal to leafpad so no need to be referring back and forth. This is so Kubuntu knows where to find its drives.
Exit the GUI and press ctrl-alt-delete or type 'shutdown -h now' in the sysresccd console, remove the cd. Turn off the comp.
Now get your screwdrivers out, make sure no cats are around and swap the drives over, or just stick the new one in and chuck the old one, though it's handy to use it as an external HD, or a good start for incremental backups of the system, personally i don;t care what you do with it, it os yours after all, but your hopefully finished with it.
Now boot up the comp as a check, it should just boot up into windows if it is duel boot (or not at all if you have no windows.) Close down windows, for it is the spawn of Satan and must be crushed into the ground. It will be asking you to reboot for the new HD anyway, or wanting you to renew the license. God I hate windows.
OK, slip in the Super Grub Cd and boot from it. It is straight forward and will detect and menu.lst on your system and allow you to boot into Kubuntu. Boot at normal. Now you need to install Grub on the MBR. Open a Konsole and simply type.
Code:
sudo grub-install /dev/hda
Code:
sudo grub-install /dev/sda
Now reboot the system, your grub should be there. Congratulations you have a new bigger hard drive and your old system back.
Comment