Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] [Resolved] Replacing software-raided disks with dd, underlying-partitions-and-all: Will this work?



Thanks to the people who replied to this. Here's how I resolved it in
case anyone else has to do something similar:


A) Getting the new disks in Server A:

1) Shut down the server and switched out the broken disk (/dev/sda)
with one of the new, big ones, then followed Pier's advice:

# Cloned the boot record:
dd if=/dev/sdb of=/dev/sda bs=512 count=1

# Cloned the partition table:
sfdisk --dump /dev/sdb | sfdisk /dev/sda

# Added the new disk to the array:
mdadm --manage /dev/md0 --add /dev/sda1
mdadm --manage /dev/md1 --add /dev/sda7
...etc

# Rebooted to prove everything worked.

2) Shut down the server and switched out the previously live disk
(/dev/sdb) with one of the new, big ones and did the same as in step
(1) but the other way around.

3) Tried to add a new partition so that I could use to new space on
the bigger disk, and got told "No space left on device" or something
similar. Realized that my extended partition was the right a size to
fill up the old disk but too small to fill up the new one, so I'd have
to grow the extended partition before I could add a new logical one to
it. Parted told me that the extended partition (partition 4) started
at 12127.192 and that the disk ended at 152587.890. So I did:

parted /dev/sda resize 4 12127.192 152587.890
fdisk /dev/sda]
[n, create a logical partition to fill all available space, which
appeared as /dev/sda9]
[w, write the partition table and exit]

parted /dev/sdb resize 4 12127.192 152587.890
fdisk /dev/sdb
[n, create a logical partition to fill all available space, which
appeared as /dev/sdb9]
[w, write the partition table and exit]

4) Added a RAID partition with my new partitions:

/sbin/mdadm --create /dev/md7 --verbose --level=1 --raid-devices=2
/dev/sda9 /dev/sdb9

# Updated /etc/mdadm.conf

# Made a directory to mount it on and added the new partition to /etc/fstab

# Rebooted to prove it all worked.


B) Put the old still-working disk that I took out of Server 1 into Server 2:

1) Shut down the server and switched the dead disk for the working one
from Server 1.

2) Booted from a live CD and erased the RAID superblock, following
Edward's advice.
(Edward suggested zeroing the original disk before taking it out of
Server 1, which would make sense, but I decided to hang on to it for a
bit in its original state in case I discovered I'd done something
wrong and I wanted to put it back in its original server, then zero it
later on Server 2 with Knoppix.)
mdadm --zero-superblock /dev/sda1
mdadm --zero-superblock /dev/sda2
...etc

3) Rebooted the server and did the same as for A1 above.

-- 
Edmund Edgar
Founder, KK Social Minds
Educational Technology for the Web and Virtual Worlds

ed@example.com
+81 090 3912 3380
Skype: edmundedgar
Second Life: Edmund Earp
Linked In: edmundedgar
Twitter: @edmundedgar
http://www.socialminds.jp


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links