Re: [Hampshire] Hard disk failing

Top Page

Reply to this message
Author: Keith Edmunds
Date:  
To: hampshire
Subject: Re: [Hampshire] Hard disk failing
On Sat, 24 Nov 2012 13:17:12 +0000, kevin.safford@??? said:

> What's my best way forward from here? When I've swapped disks, can I use
> dd to write my rescued information to the new hard drive?


Here's how I would do it (so "best" for me; not necessarily "best" for
you).

Put both disks in system. Boot from favourite rescue CD. Assume /dev/sda
is your failing disk and /dev/sdb is the new one. Be CERTAIN of this
otherwise you'll lose data.

# Replicate the partition table:
sfdisk -d /dev/sda|sfdisk /dev/sdb

# Make the filesystems on the new disk:
for a in 1 3;do mke2fs -t ext4 /dev/sdb$a;done

# Make the swap partition:
mkswap /dev/sdb5

# Create two mount points:
mkdir /to /from

# Mount the first pair of partitions
mount -r /dev/sda1 /from
mount /dev/sdb1 /to

# Copy, preserving metadata
tar -C /from -cf -|tar -C /to -xvf -

# Unmount
umount /to /from

# Repeat above to copy all data partition (just root and home in your case)

Shut down, remove old disk, leave new disk, boot rescue CD and write boot
block. Lots of ways of doing that, some of which are distro-dependent and
they will vary depending on whether you're using lilo, grub 1 or grub 2.
If you need specific instructions, shout.
--
We're looking for smart Linux people:
http://www.tiger-computing.co.uk/jobs

--
Please post to: Hampshire@???
Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire
LUG URL: http://www.hantslug.org.uk
--------------------------------------------------------------