[opensuse] build RAID1 partition from previously used ordinary partition without data loss?
I'm trying to do this without YaST because I find curses YaST so hard to use and want to understand how to manage RAID without depending on working X to do it. I build a system using 250G and 320G HDs. The first 250G on the 320G was set up as a virtual clone of the 250G, with 7 partitions on each making up v1.0 md0-md6 during openSUSE 11.0 installation. The remaining 152G space on the 320G was created as an ordinary EXT2 partition. I've since replaced the 250G with a 500G, succeeded in replacing the individual RAID elements on md0-md6, and want to create a clone of the 152G partition on the 320G disk on the 500G disk, then create md7 from those two partitions. I tried initially creating md7 using only the original 152G partition to ensure against data loss, then add the new 152G partition to the existing single partition md7. These mdX partitions are all type 0xFD in the partition tables. But 'mdadm -cv/dev/md7 --level=1 /dev/sdb14' produces an error message "mdadm: -c does not set the mode, and so cannot be the first option". So, I don't know what to do. If there's anything in the mdadm man page on converting existing partitions to RAID1 elements, I'm missing it. mdadm.conf is the attachment, which is the original, plus my last line addition for the new array minus a UUID. -- "The wise are known for their understanding, and pleasant words are persuasive." Proverbs 16:21 (New Living Translation) Team OS/2 ** Reg. Linux User #211409 ** a11y rocks! Felix Miata *** http://fm.no-ip.com/
On Mon, 16 Apr 2012 02:06:26 Felix Miata wrote:
I'm trying to do this without YaST because I find curses YaST so hard to use and want to understand how to manage RAID without depending on working X to do it. [...] I tried initially creating md7 using only the original 152G partition to ensure against data loss, then add the new 152G partition to the existing single partition md7. These mdX partitions are all type 0xFD in the partition tables. But 'mdadm -cv/dev/md7 --level=1 /dev/sdb14' produces an error message "mdadm: -c does not set the mode, and so cannot be the first option". So, I don't know what to do. If there's anything in the mdadm man page on converting existing partitions to RAID1 elements, I'm missing it.
mdadm.conf is the attachment, which is the original, plus my last line addition for the new array minus a UUID.
Felix, As I remember it (it has been a while) the basic workflow is: - create the RAID1 array using just the partition with the existing dara - start the array in degraded mode - add the new (empty) partition (it may or may not need the filesystem created, I can't remember exactly) - tell mdadm to rebuild the array, which will copy the data from the first partition to the second - may need to restart the array in normal mode (I can't remember if this is done automatically after the rebuild). Read the man page carefully - it is all there. I converted /home and and a couple of other partitions to RAID1 this way but that was at least a couple of years ago so the exact commands I can't remember - I'd have to go look at the man page myself if I needed to do it again. HTH. Regards, Rodney. -- ========================================================================== Rodney Baker VK5ZTV rodney.baker@iinet.net.au ========================================================================== -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Felix Miata wrote:
I've since replaced the 250G with a 500G, succeeded in replacing the individual RAID elements on md0-md6, and want to create a clone of the 152G partition on the 320G disk on the 500G disk, then create md7 from those two partitions.
I tried initially creating md7 using only the original 152G partition to ensure against data loss, then add the new 152G partition to the existing single partition md7.
Sounds good.
These mdX partitions are all type 0xFD in the partition tables. But 'mdadm -cv/dev/md7 --level=1 /dev/sdb14' produces an error message "mdadm: -c does not set the mode, and so cannot be the first option". So, I don't know what to do. If there's anything in the mdadm man page on converting existing partitions to RAID1 elements, I'm missing it.
Shouldn't your command be: mdadm --create /dev/md7 --level=1 -n1 /dev/sdb14 -- Per Jessen, Zürich (4.9°C) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 04/15/2012 11:26 PM, Per Jessen wrote:
Felix Miata wrote:
I've since replaced the 250G with a 500G, succeeded in replacing the individual RAID elements on md0-md6, and want to create a clone of the 152G partition on the 320G disk on the 500G disk, then create md7 from those two partitions.
I tried initially creating md7 using only the original 152G partition to ensure against data loss, then add the new 152G partition to the existing single partition md7. Sounds good.
These mdX partitions are all type 0xFD in the partition tables. But 'mdadm -cv/dev/md7 --level=1 /dev/sdb14' produces an error message "mdadm: -c does not set the mode, and so cannot be the first option". So, I don't know what to do. If there's anything in the mdadm man page on converting existing partitions to RAID1 elements, I'm missing it. Shouldn't your command be:
mdadm --create /dev/md7 --level=1 -n1 /dev/sdb14 This might be better:
mdadm --create /dev/md7 --level=1 -n2 /dev/sdb14 missing
From the man page:
To create a "degraded" array in which some devices are missing, simply give the word "missing" in place of a device name. This will cause mdadm to leave the corresponding slot in the array empty. For a RAID4 or RAID5 array at most one slot can be "missing"; for a RAID6 array at most two slots. For a RAID1 array, only one real device needs to be given. All of the others can be "missing".
Jim -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Jim Cunning wrote:
On 04/15/2012 11:26 PM, Per Jessen wrote:
Felix Miata wrote:
I've since replaced the 250G with a 500G, succeeded in replacing the individual RAID elements on md0-md6, and want to create a clone of the 152G partition on the 320G disk on the 500G disk, then create md7 from those two partitions.
I tried initially creating md7 using only the original 152G partition to ensure against data loss, then add the new 152G partition to the existing single partition md7. Sounds good.
These mdX partitions are all type 0xFD in the partition tables. But 'mdadm -cv/dev/md7 --level=1 /dev/sdb14' produces an error message "mdadm: -c does not set the mode, and so cannot be the first option". So, I don't know what to do. If there's anything in the mdadm man page on converting existing partitions to RAID1 elements, I'm missing it. Shouldn't your command be:
mdadm --create /dev/md7 --level=1 -n1 /dev/sdb14 This might be better:
mdadm --create /dev/md7 --level=1 -n2 /dev/sdb14 missing
Thanks Jim, that is _much_ better. I was typing from memory. -- Per Jessen, Zürich (6.0°C) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 4/15/2012 12:36 PM, Felix Miata wrote:
I'm trying to do this without YaST because I find curses YaST so hard to use and want to understand how to manage RAID without depending on working X to do it.
I build a system using 250G and 320G HDs. The first 250G on the 320G was set up as a virtual clone of the 250G, with 7 partitions on each making up v1.0 md0-md6 during openSUSE 11.0 installation. The remaining 152G space on the 320G was created as an ordinary EXT2 partition.
I've since replaced the 250G with a 500G, succeeded in replacing the individual RAID elements on md0-md6, and want to create a clone of the 152G partition on the 320G disk on the 500G disk, then create md7 from those two partitions.
I tried initially creating md7 using only the original 152G partition to ensure against data loss, then add the new 152G partition to the existing single partition md7. These mdX partitions are all type 0xFD in the partition tables. But 'mdadm -cv/dev/md7 --level=1 /dev/sdb14' produces an error message "mdadm: -c does not set the mode, and so cannot be the first option". So, I don't know what to do. If there's anything in the mdadm man page on converting existing partitions to RAID1 elements, I'm missing it.
mdadm.conf is the attachment, which is the original, plus my last line addition for the new array minus a UUID.
Since this isn't your boot filesystem it's easy. mdadm -C -l 1 -n 2 /dev/md7 /dev/<new empty partition> missing "missing" is litteral, it's a special value you can use in place of a device for exactly this situation. That should create a new raid1 array of 2 devices, in degraded mode using only the new empty partition and the other device is "missing" and not touching the old partition. Note also capital -C not -c, or lower case --create if you prefer. Now mkfs /dev/md7, mount it to a temp location, and rsync everything from the old filesystem to the new filesystem. mkfs /dev/md7 mkdir /md7 mount /dev/md7 /md7 rsync -avW --inplace /foo/* /md7 Then umount both the old and new filesystems. umount /foo umount /md7 rmdir /md7 Update /etc/fstab so that filesystem is mounted from /dev/md7 instead of from the old partition. sed -i 's;/dev/<old partition>;/dev/md7;' /etc/fstab ( I would do it by hand, not by sed, this is just to have a short thing to write that does describe what to do for reference ) mount the filesystem by name and verify it mounted /dev/md7 and not the old disk/partition. mount /foo mount |grep foo Verify the data is ok and everything works exactly as it did before. If you are sure the new copy is all OK and you are sure it's ok to blast away the original partition, then add the old partition to the new array. mdadm -a /dev/md7 /dev/<old partition> Then watch it rebuild watch cat /proc/mdstat Ctrl-C to exit "watch" -- bkw -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (5)
-
Brian K. White
-
Felix Miata
-
Jim Cunning
-
Per Jessen
-
Rodney Baker