Hello all. I have a server with a linux software raid1 setup between two drives of the same model....one hard drive as primary ide master and second hard drive as secondary master. Now primary master hard drive is displaying a lot of SMART errors so I would like to remove it and replace with another drive....different brand but same size. Partitions are /dev/md0 till /dev/md5. I think I know what to do based on mdadm man page and this list's archives but there is no harm in confirming right? ;) From this post http://lists.centos.org/pipermail/centos/2006-April/063076.html I plan on removing the old partitions from the array like this..... mdadm /dev/mdx -r /dev/hdax. Then I will shut down the server, replace the hard drive, make the server boot from second IDE drive and hopefully boot into Centos. From there do I have to manually create each /dev/mdx partition and then re-add them like this....mdadm /dev/mdx -a /dev/hdax ? That is what I am not sure about whether I have to partiton the drive exactly like the old one or if Centos mdadm can do some magic for me with a blank drive. TIA!!
Joseph Cheng wrote:
Hello all. I have a server with a linux software raid1 setup between two drives of the same model....one hard drive as primary ide master and second hard drive as secondary master. Now primary master hard drive is displaying a lot of SMART errors so I would like to remove it and replace with another drive....different brand but same size. Partitions are /dev/md0 till /dev/md5. I think I know what to do based on mdadm man page and this list's archives but there is no harm in confirming right? ;) From this post http://lists.centos.org/pipermail/centos/2006-April/063076.html I plan on removing the old partitions from the array like this..... mdadm /dev/mdx -r /dev/hdax. Then I will shut down the server, replace the hard drive, make the server boot from second IDE drive and hopefully boot into Centos. From there do I have to manually create each /dev/mdx partition and then re-add them like this....mdadm /dev/mdx -a /dev/hdax ? That is what I am not sure about whether I have to partiton the drive exactly like the old one or if Centos mdadm can do some magic for me with a blank drive. TIA!!
Couple of things to watch out.
What boot loader are you using? If it is Grub, check if it was installed on partition, not in MBR of first drive. If it was in MBR, there is a good chance you don't have it mirrored on second drive. You'll need working boot loader (most likely Grub) on second drive in order to boot from it.
Disk size... It is next to impossible to find "different brand but same size". If the label says 80GB, it means "somewhere around 80GB". You want to look at LBA count (it's printed almost on all hard drives, but often hard to find in specifications). It's basically the number of sectors that the drive has. You want the drive that has at least the number of sectors as your existing drive(s). If you already got the new drive and it is few sectors short, all is not lost. You'll just have a bit of additional work. You'll need to shrink some partition. Swap partition is usually good candidate since it doesn't contain any data. You can also shrink a partition that holds file system, but if you make mistake you might end up loosing some data. Another thing to keep in mind when shrinking partitions is that Linux stores RAID metadata at the end of the partition. If you are shrinking partition that holds Linux RAID device, the best thing (if it was RAID 1 volume) is to ditch the md device for it, shrink the file system to smaller size, and recreate md device. Your data should survive the operation. When shrinking file system, have in mind you'll need to have some extra space of RAID metadata information at the end of partition (you'll need to shrink file system to be smaller than the final partition size).
You'll need to partition the new drive manually. Remember to tag partitions as "Linux raid autodetect" (by default fdisk will tag them as "Linux"). Tag for Linux raid autodetect is fd. New partitions must be the same size (in blocks) as the partitions you are replacing or larger. If you make them larger, the extra space will be unused.
If your boot loader was installed in the partition, it'll get mirrored automatically. If it was in MBR, you'll have to install it by hand onto the drive you just replaced.
The rest should more or less go smooth.
I tested RAID 1 with differents size hard disk , it is work.
You need first, execute command sfdisk -l /dev/hd_GOOD > partitions.txt Second execute command sfdisk /dev/hd_NEWDISK < partitons.txt.
After recover process normal RAID recover.
I hope to help you
Adriano Frare
Aleksandar Milivojevic wrote:
Joseph Cheng wrote:
Hello all. I have a server with a linux software raid1 setup between two drives of the same model....one hard drive as primary ide master and second hard drive as secondary master. Now primary master hard drive is displaying a lot of SMART errors so I would like to remove it and replace with another drive....different brand but same size. Partitions are /dev/md0 till /dev/md5. I think I know what to do based on mdadm man page and this list's archives but there is no harm in confirming right? ;) From this post http://lists.centos.org/pipermail/centos/2006-April/063076.html I plan on removing the old partitions from the array like this..... mdadm /dev/mdx -r /dev/hdax. Then I will shut down the server, replace the hard drive, make the server boot from second IDE drive and hopefully boot into Centos. From there do I have to manually create each /dev/mdx partition and then re-add them like this....mdadm /dev/mdx -a /dev/hdax ? That is what I am not sure about whether I have to partiton the drive exactly like the old one or if Centos mdadm can do some magic for me with a blank drive. TIA!!
Couple of things to watch out.
What boot loader are you using? If it is Grub, check if it was installed on partition, not in MBR of first drive. If it was in MBR, there is a good chance you don't have it mirrored on second drive. You'll need working boot loader (most likely Grub) on second drive in order to boot from it.
Disk size... It is next to impossible to find "different brand but same size". If the label says 80GB, it means "somewhere around 80GB". You want to look at LBA count (it's printed almost on all hard drives, but often hard to find in specifications). It's basically the number of sectors that the drive has. You want the drive that has at least the number of sectors as your existing drive(s). If you already got the new drive and it is few sectors short, all is not lost. You'll just have a bit of additional work. You'll need to shrink some partition. Swap partition is usually good candidate since it doesn't contain any data. You can also shrink a partition that holds file system, but if you make mistake you might end up loosing some data. Another thing to keep in mind when shrinking partitions is that Linux stores RAID metadata at the end of the partition. If you are shrinking partition that holds Linux RAID device, the best thing (if it was RAID 1 volume) is to ditch the md device for it, shrink the file system to smaller size, and recreate md device. Your data should survive the operation. When shrinking file system, have in mind you'll need to have some extra space of RAID metadata information at the end of partition (you'll need to shrink file system to be smaller than the final partition size).
You'll need to partition the new drive manually. Remember to tag partitions as "Linux raid autodetect" (by default fdisk will tag them as "Linux"). Tag for Linux raid autodetect is fd. New partitions must be the same size (in blocks) as the partitions you are replacing or larger. If you make them larger, the extra space will be unused.
If your boot loader was installed in the partition, it'll get mirrored automatically. If it was in MBR, you'll have to install it by hand onto the drive you just replaced.
The rest should more or less go smooth.
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Adriano Frare spake the following on 11/7/2006 5:51 PM:
I tested RAID 1 with differents size hard disk , it is work.
You need first, execute command sfdisk -l /dev/hd_GOOD > partitions.txt Second execute command sfdisk /dev/hd_NEWDISK < partitons.txt.
After recover process normal RAID recover.
Or shorten it with a pipe; sfdisk -l /dev/hd_GOOD | sfdisk /dev/hd_NEWDISK
Greetings, Scott.
8 ?????? 2006 ?., 19:40:44 you have wrote:
Adriano Frare spake the following on 11/7/2006 5:51 PM:
I tested RAID 1 with differents size hard disk , it is work.
You need first, execute command sfdisk -l /dev/hd_GOOD > partitions.txt Second execute command sfdisk /dev/hd_NEWDISK < partitons.txt.
After recover process normal RAID recover.
Or shorten it with a pipe; sfdisk -l /dev/hd_GOOD | sfdisk /dev/hd_NEWDISK
To be totally correct, use -uS, as when info is displayed in block units, some rounding of the size might occur.
Compare this:
[root@runchik ~]# sfdisk -l /dev/sda
Disk /dev/sda: 8923 cylinders, 255 heads, 63 sectors/track Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System /dev/sda1 * 0+ 12 13- 104391 83 Linux /dev/sda2 13 143 131 1052257+ 82 Linux swap /dev/sda3 144 8922 8779 70517317+ 8e Linux LVM /dev/sda4 0 - 0 0 0 Empty
With this:
[root@runchik ~]# sfdisk -uS -l /dev/sda
Disk /dev/sda: 8923 cylinders, 255 heads, 63 sectors/track Units = sectors of 512 bytes, counting from 0
Device Boot Start End #sectors Id System /dev/sda1 * 63 208844 208782 83 Linux /dev/sda2 208845 2313359 2104515 82 Linux swap /dev/sda3 2313360 143347994 141034635 8e Linux LVM /dev/sda4 0 - 0 0 Empty
Alexey Loukianov spake the following on 11/15/2006 7:05 AM:
Greetings, Scott.
8 ?????? 2006 ?., 19:40:44 you have wrote:
Adriano Frare spake the following on 11/7/2006 5:51 PM:
I tested RAID 1 with differents size hard disk , it is work.
You need first, execute command sfdisk -l /dev/hd_GOOD > partitions.txt Second execute command sfdisk /dev/hd_NEWDISK < partitons.txt.
After recover process normal RAID recover.
Or shorten it with a pipe; sfdisk -l /dev/hd_GOOD | sfdisk /dev/hd_NEWDISK
To be totally correct, use -uS, as when info is displayed in block units, some rounding of the size might occur.
Compare this:
[root@runchik ~]# sfdisk -l /dev/sda
Disk /dev/sda: 8923 cylinders, 255 heads, 63 sectors/track Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System /dev/sda1 * 0+ 12 13- 104391 83 Linux /dev/sda2 13 143 131 1052257+ 82 Linux swap /dev/sda3 144 8922 8779 70517317+ 8e Linux LVM /dev/sda4 0 - 0 0 0 Empty
With this:
[root@runchik ~]# sfdisk -uS -l /dev/sda
Disk /dev/sda: 8923 cylinders, 255 heads, 63 sectors/track Units = sectors of 512 bytes, counting from 0
Device Boot Start End #sectors Id System /dev/sda1 * 63 208844 208782 83 Linux /dev/sda2 208845 2313359 2104515 82 Linux swap /dev/sda3 2313360 143347994 141034635 8e Linux LVM /dev/sda4 0 - 0 0 Empty
I actually forgot about this post, but I meant to post sfdisk -d /dev/hd_GOOD | sfdisk /dev/hd_NEWDISK to get the partition table dump that sfdisk is looking for.
Çäðàâñòâóéòå, Scott.
Âû ïèñàëè 15 ?????? 2006 ?., 20:07:27:
I actually forgot about this post, but I meant to post sfdisk -d /dev/hd_GOOD | sfdisk /dev/hd_NEWDISK to get the partition table dump that sfdisk is looking for.
On x86 servers I prefer to use another method:
# dd if=/dev/hd_GOOD of=/dev/hd_NEW bs=512 count=1 # sfdisk -R /dev/hd_NEW
This copies full MBR, including bootloader code, to a new disk. When using md device as a root - this trick allows you to avoid using GRUB to reinstall stage1 on a new HDD.