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