Operating System - Linux
1827752 Members
3332 Online
109969 Solutions
New Discussion

boot disk replacement (a newbie question)

 
SOLVED
Go to solution
Fedon Kadifeli
Super Advisor

boot disk replacement (a newbie question)

My Linux box has a single disk (10GB). I have several partitions (boot, swap, extended etc.) on it. I want to replace this disk with a larger new one (30GB). The new disk is attached to the system as /dev/hdd right now; the old one is at /dev/hda. After copying the old disk over the new one, I will remove the old disk and the new disk will become /dev/hda. What is the best and shortest method of copying all the partitions to the new disk?
5 REPLIES 5
Jerome Henry
Honored Contributor

Re: boot disk replacement (a newbie question)

Hi,

Several solutions :
-from a shell, use dd (man dd for details, ask here if you need).
-drive image works on ext2 partitions, but you have to buy this software.
- my favourite, mondo rescue, look at :
http://www.microwerks.net/~hugo/

hth

J
You can lean only on what resists you...
Fedon Kadifeli
Super Advisor

Re: boot disk replacement (a newbie question)

The problem is that I want to make partitions larger, not identical (dd will not help me). I created the new partitions (larger than the older ones). Now I want to copy the files from the old partitions to the new partitions. What is the most effective command combination to copy files, directories, links, devices etc? cp, cpio, tar? What is the command to make the first new partition bootable? What should be done for the new swap swap partition?
Alexander Chuzhoy
Honored Contributor
Solution

Re: boot disk replacement (a newbie question)

as for swap partition
1. use fdisk to create a new partition, then change it's id to 82
(see help inside fdisk)
2. If your new swap partition is /dev/hda3
then issue this command
mkswap /dev/hda3
3.then create entry in your /etc/fstab
/dev/hda3 swap swap defaults 0 0

if you copied your old /etc/fstab then edit it and find the line with swap to change it to point to /dev/hda3


to make your your disk bootable if you use grub:
grub-install /dev/hda
or if you have another boot manager in mbr and you simply want to make your /boot partition to be bootable - grub-install /dev/hda1 (if /boot is mounted on /dev/hda1)



anyway I suggest you to use the "ghost" application. It alows you to copy the whole hard drive to a larger one.
Huc_1
Honored Contributor

Re: boot disk replacement (a newbie question)

To partition the new disk use
fdisk /dev/hdd

"once in there 'm' for help"

You can also check your "old" disk using

fdisk /dev/hda

"'p' to print partiton setup/tables and 'q' to quite"

reading the manual page of fdisk is safer

as for what tools to use for copy I would you use the one you know best in my case tar would be the choise.

only mark you partion as bootable at the last moment before switching disk you can use fdisk /dev/hdd using option 'a' on the first partition to do this !

A word of caution on all you do in fdisk, specialy with your old system disk, note viewing is no problem, but beware before you commit a 'w' ( write option in fdisk ) only do this on your new disk.

You will have to physicaly switch the disks or do a software switch , this means run grub or lilo after having the config point to the right partion/disk

Hopefully some of this will help you

J-P



Smile I will feel the difference
Huc_1
Honored Contributor

Re: boot disk replacement (a newbie question)

Nice and fast Alexander I had been typing my answer (phone interrupts etc) and when I posted my reply and did a refresh saw your's .. once again nice but I notice we both did not mention
the command to do a new file system on the partition's.

so mkfs.ext2, mkfs.ext3 what ever your choise is needed in order to structure the new partitons, before being able to populate them

The whole process would be more ease using 'ghost' as per Alexander reply.

J-P
Smile I will feel the difference