Creating partitionable raid on existing disk (was: Re: Partitioned raid and major number)
From: Miquel van Smoorenburg <hidden>
Date: 2004-03-09 15:32:23
On 2004.03.01 02:09, Neil Brown wrote:
On Monday March 1, miquels@cistron.nl wrote:quoted
What do you think of that approach ? Converting from a 1 disk setup to a 2-disk RAID1 setup on an existing system is something that lots of people want to do, seeing that the software raid howto even has a few paragraphs dedicated to it.What I am thinking of doing is allowing: md=0,1,/dev/sda to assemble a raid1 array without a superblock which uses just /dev/sda. Then md=d0,1,/dev/sda root=/dev/md_d0p1 would boot off md/d0p1 instead of sda1, but it would be the same data. Then you would be able to add mirrors to this with something like: mdadm --grow /dev/md/d0 --disks=2 mdadm /dev/md/d0 --add /dev/sdb and you could convert it into an array with a persistent superblock using: mdadm --grow /dev/md/d0 --persistent=yes The only difficult bit is the setting a persistent superblock means reducing the size of the device, and I would like it to be hard to do that in error, but not impossible to do it.
Any progress on this? The right thing to do would probably be to check if the device actually has partitions - refuse to reduce the size of the device if it doesn't have any partitions, or if any partition overlaps with the MD superblock. That should be easy enough I think. But it would take changes in both userlevel tools (add --grow to mdadm) and the kernel, right ? So in the short run, I'll be better off by booting a Knoppix CD and running mdadm from there, I suppose. Are you interested in the patch I made to be able to initialize (but not run!) an array on a disk that is otherwise busy (i.e. can't be bd_claim()ed) ? Basically it just adds a SET_ARRAY_INFO_CONFONLY ioctl. I have patches for both the kernel and mkraid, and they're pretty simple. Mike.