|
|
Replacing an old hard drive
Hi,
I have an old hard drive that has become flaky but still readable and I want
to replace it with a new drive. This is what I have done so far using a
knoppix CD:
1) Install hardware making the new hard drive master (hda) and the old drive
slave (hdb)
2) Create Windows and Linux partitions on the new drive (hda) similar to
those on old (hdb)
3) Make 'Windows-C' and /boot partitions bootable
This is what I plan to do (after booting up in knoppix)
4) Copy contents from of partitions in hdb to those in hda.Should I do fsck
on the old partitions before I copy? I plan to copy the partion boot record
as well by using commands of the form
dd if=/dev/hdb10 of=/dev/hda9 bs=4096
Will this create any problems if the partitions are of different size?
5) Edit the /etc/fstab file in hda '/' partition to reflect the new
partition locations
6) Edit '/boot/grub/menu.lst' in hda '/boot' partition to reflect
new locations of bootable partitions
7) Install grub on MBR of hda and reboot using the following commands (Note
that hda11 is my '/' partition and hda2 is my '/boot' partition
mkdir /mnt/restore
mount /dev/hda11 /mnt/restore
mount /dev/hda2 /mnt/restore/boot
mount -t proc proc /mnt/restore/proc
mount -o bind /dev /mnt/restore/dev
chroot /mnt/restore
grub-install /dev/hda
Thanks in advance for your help.
|
|
0
|
|
|
|
Reply
|
rkannan9526 (10)
|
8/19/2007 1:35:17 PM |
|
At Sun, 19 Aug 2007 13:35:17 GMT R Kannan <rkannan@nospam.peoplepc.com> wrote:
>
> Hi,
>
> I have an old hard drive that has become flaky but still readable and I want
> to replace it with a new drive. This is what I have done so far using a
> knoppix CD:
>
>
> 1) Install hardware making the new hard drive master (hda) and the old drive
> slave (hdb)
>
> 2) Create Windows and Linux partitions on the new drive (hda) similar to
> those on old (hdb)
>
> 3) Make 'Windows-C' and /boot partitions bootable
>
> This is what I plan to do (after booting up in knoppix)
>
> 4) Copy contents from of partitions in hdb to those in hda.Should I do fsck
> on the old partitions before I copy? I plan to copy the partion boot record
Yes, fsck the old partitions.
> as well by using commands of the form
>
> dd if=/dev/hdb10 of=/dev/hda9 bs=4096
>
> Will this create any problems if the partitions are of different size?
Probably. You really should do a proper file-based backup:
mkfs.ext3 -L <label> /dev/hda9
mount -v /dev/hda9 /mnt
dump -of - /<mount point of /dev/hdb10> | (cd /mnt; restore -rf -)
Repeat for all other partitions.
>
> 5) Edit the /etc/fstab file in hda '/' partition to reflect the new
> partition locations
Use LABEL= and put labels on all partitions.
>
> 6) Edit '/boot/grub/menu.lst' in hda '/boot' partition to reflect
> new locations of bootable partitions
>
> 7) Install grub on MBR of hda and reboot using the following commands (Note
> that hda11 is my '/' partition and hda2 is my '/boot' partition
>
> mkdir /mnt/restore
> mount /dev/hda11 /mnt/restore
> mount /dev/hda2 /mnt/restore/boot
> mount -t proc proc /mnt/restore/proc
> mount -o bind /dev /mnt/restore/dev
> chroot /mnt/restore
> grub-install /dev/hda
>
> Thanks in advance for your help.
>
>
>
--
Robert Heller -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
heller@deepsoft.com -- Contract Programming: C/C++, Tcl/Tk
|
|
0
|
|
|
|
Reply
|
heller (2950)
|
8/19/2007 1:47:22 PM
|
|
Robert Heller wrote:
>>
>> 4) Copy contents from of partitions in hdb to those in hda.Should I do
>> fsck on the old partitions before I copy? I plan to copy the partion boot
>> record
>
> Yes, fsck the old partitions.
>
>> as well by using commands of the form
>>
>> dd if=/dev/hdb10 of=/dev/hda9 bs=4096
>>
>> Will this create any problems if the partitions are of different size?
>
But the partitions in /dev/hda are bigger than the corresponding ones
in /dev/hdb. Will 'dd' still create a problems?
> Probably. You really should do a proper file-based backup:
>
> mkfs.ext3 -L <label> /dev/hda9
> mount -v /dev/hda9 /mnt
> dump -of - /<mount point of /dev/hdb10> | (cd /mnt; restore -rf -)
>
My understanding is that file based copy will not copy the 'partion boot
record'.
> Repeat for all other partitions.
>
>
|
|
0
|
|
|
|
Reply
|
rkannan9526 (10)
|
8/19/2007 2:48:58 PM
|
|
R Kannan wrote:
> Robert Heller wrote:
>>>
>>> 4) Copy contents from of partitions in hdb to those in hda.Should I do
>>> fsck on the old partitions before I copy? I plan to copy the partion
>>> boot record
>>
>> Yes, fsck the old partitions.
>>
>>> as well by using commands of the form
>>>
>>> dd if=/dev/hdb10 of=/dev/hda9 bs=4096
>>>
>>> Will this create any problems if the partitions are of different size?
>>
> But the partitions in /dev/hda are bigger than the corresponding ones
> in /dev/hdb. Will 'dd' still create a problems?
>
>> Probably. You really should do a proper file-based backup:
>>
>> mkfs.ext3 -L <label> /dev/hda9
>> mount -v /dev/hda9 /mnt
>> dump -of - /<mount point of /dev/hdb10> | (cd /mnt; restore -rf -)
>>
>
> My understanding is that file based copy will not copy the 'partion boot
> record'.
>
>> Repeat for all other partitions.
>>
>>
File-by-file isn't enough for windows for the reason you stated. The extra
step I needed AFTER a win2k file-by-file restore to a new disk was to boot
the windows cd and start up the recovery console. From there, enter
FIXBOOT C: or whatever drive letter the recovery console indicates ...
which might not be C:. This creates the new partition boot record, at
least it did for me. By the way, I used ntfs-3g to write the restore files
to the new disk. No problems there.
You will need to tell the mbr about grub as well. Like this:
grub> root (hd0,1)
grub> setup (hd0)
.... assuming /boot is in the second partition, change as needed.
I used partimage for windows backups for a while and then discovered
that their warning about ntfs support being experimental is quite
true: it doesn't always work (yet). Caveat Administrator.
|
|
0
|
|
|
|
Reply
|
roby (99)
|
8/19/2007 3:36:28 PM
|
|
At Sun, 19 Aug 2007 10:48:58 -0400 R Kannan <rkannan@nospam.peoplepc.com> wrote:
>
> Robert Heller wrote:
> >>
> >> 4) Copy contents from of partitions in hdb to those in hda.Should I do
> >> fsck on the old partitions before I copy? I plan to copy the partion boot
> >> record
> >
> > Yes, fsck the old partitions.
> >
> >> as well by using commands of the form
> >>
> >> dd if=/dev/hdb10 of=/dev/hda9 bs=4096
> >>
> >> Will this create any problems if the partitions are of different size?
> >
> But the partitions in /dev/hda are bigger than the corresponding ones
> in /dev/hdb. Will 'dd' still create a problems?
Yes. You will have a small file system on a larger partition -- some of
the partition will not be accessable. Using dd to copy a file system
only makes sense if the destination partition is *the same size* as the
source partition. In all other cases, the result will be less than
satisfactory, in various ways.
>
> > Probably. You really should do a proper file-based backup:
> >
> > mkfs.ext3 -L <label> /dev/hda9
> > mount -v /dev/hda9 /mnt
> > dump -of - /<mount point of /dev/hdb10> | (cd /mnt; restore -rf -)
> >
>
> My understanding is that file based copy will not copy the 'partion boot
> record'.
True. This record can be copied with a special dd command:
dd if=<source> of=<dest> bs=512 count=1
Although it might make *better* sense to re-create this boot record (eg
re-run lilo). That is, you really should make a boot floppy or use a
rescue CD (or the install CD in rescue mode) to regenerate the boot
records and otherwise get the MBR set up (load the boot loader, etc.).
This way anything relating to disk geometry and the location of things
like secondary boot loader records and kernels and init ramdisk images
will be correct. Whenever *I* do disk transplants or 'cross-installs'
or disk upgrades, etc. this is what I do.
You really *don't* want to copy a *failing* disk's file systems
completely with dd -- it is all to possible to end up with a broken file
system on the destination disk. Using a backup program (like
dump/restore) with a "skip bad file" type of option is better. Any
files that failed to be copied will need to be restored from a (older)
backup or if a system file, by forcably re-installing the package(s) the
file is part of.
>
> > Repeat for all other partitions.
> >
> >
>
>
--
Robert Heller -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
heller@deepsoft.com -- Contract Programming: C/C++, Tcl/Tk
|
|
0
|
|
|
|
Reply
|
heller (2950)
|
8/19/2007 4:16:45 PM
|
|
At Sun, 19 Aug 2007 11:36:28 -0400 Roby <roby@no-address.net> wrote:
>
> R Kannan wrote:
>
> > Robert Heller wrote:
> >>>
> >>> 4) Copy contents from of partitions in hdb to those in hda.Should I do
> >>> fsck on the old partitions before I copy? I plan to copy the partion
> >>> boot record
> >>
> >> Yes, fsck the old partitions.
> >>
> >>> as well by using commands of the form
> >>>
> >>> dd if=/dev/hdb10 of=/dev/hda9 bs=4096
> >>>
> >>> Will this create any problems if the partitions are of different size?
> >>
> > But the partitions in /dev/hda are bigger than the corresponding ones
> > in /dev/hdb. Will 'dd' still create a problems?
> >
> >> Probably. You really should do a proper file-based backup:
> >>
> >> mkfs.ext3 -L <label> /dev/hda9
> >> mount -v /dev/hda9 /mnt
> >> dump -of - /<mount point of /dev/hdb10> | (cd /mnt; restore -rf -)
> >>
> >
> > My understanding is that file based copy will not copy the 'partion boot
> > record'.
> >
> >> Repeat for all other partitions.
> >>
> >>
> File-by-file isn't enough for windows for the reason you stated. The extra
> step I needed AFTER a win2k file-by-file restore to a new disk was to boot
> the windows cd and start up the recovery console. From there, enter
> FIXBOOT C: or whatever drive letter the recovery console indicates ...
> which might not be C:. This creates the new partition boot record, at
> least it did for me. By the way, I used ntfs-3g to write the restore files
> to the new disk. No problems there.
Right mess-windows is strange that way...
File-by-file (eg dump/restore) works just fine for Linux. I always use
dump/restore + a rescue boot (boot floppy / rescue CD) when I do disk
transplants of Linux systems.
>
> You will need to tell the mbr about grub as well. Like this:
> grub> root (hd0,1)
> grub> setup (hd0)
> ... assuming /boot is in the second partition, change as needed.
>
> I used partimage for windows backups for a while and then discovered
> that their warning about ntfs support being experimental is quite
> true: it doesn't always work (yet). Caveat Administrator.
>
--
Robert Heller -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
heller@deepsoft.com -- Contract Programming: C/C++, Tcl/Tk
|
|
0
|
|
|
|
Reply
|
heller (2950)
|
8/19/2007 4:16:49 PM
|
|
R Kannan wrote:
> Hi,
>
> I have an old hard drive that has become flaky but still readable and I
> want to replace it with a new drive. This is what I have done so far using
> a knoppix CD:
>
>
> 1) Install hardware making the new hard drive master (hda) and the old
> drive slave (hdb)
>
> 2) Create Windows and Linux partitions on the new drive (hda) similar to
> those on old (hdb)
>
> 3) Make 'Windows-C' and /boot partitions bootable
>
> This is what I plan to do (after booting up in knoppix)
>
> 4) Copy contents from of partitions in hdb to those in hda.Should I do
> fsck on the old partitions before I copy? I plan to copy the partion boot
> record as well by using commands of the form
>
> dd if=/dev/hdb10 of=/dev/hda9 bs=4096
>
> Will this create any problems if the partitions are of different size?
>
> 5) Edit the /etc/fstab file in hda '/' partition to reflect the new
> partition locations
>
> 6) Edit '/boot/grub/menu.lst' in hda '/boot' partition to reflect
> new locations of bootable partitions
>
> 7) Install grub on MBR of hda and reboot using the following commands
> (Note that hda11 is my '/' partition and hda2 is my '/boot' partition
>
> mkdir /mnt/restore
> mount /dev/hda11 /mnt/restore
> mount /dev/hda2 /mnt/restore/boot
> mount -t proc proc /mnt/restore/proc
> mount -o bind /dev /mnt/restore/dev
> chroot /mnt/restore
> grub-install /dev/hda
>
> Thanks in advance for your help.
One additional detail about moving windows: Unless the destination
is the same partition number as the source, you'll need to edit
boot.ini to fix the partition number. Windows really digs itself in!
|
|
0
|
|
|
|
Reply
|
roby (99)
|
8/19/2007 7:15:13 PM
|
|
|
6 Replies
45 Views
(page loaded in 0.079 seconds)
|
|
|
|
|
|
|
|
|