RFC - new raid superblock layout for md driver
Quoted 7 lines
The md driver in linux uses a 'superblock' written to all devices in a RAID to record the current state and geometry of a RAID and to allow the various parts to be re-assembled reliably.
The current superblock layout is sub-optimal. It contains a lot of redundancy and wastes space. In 4K it can only fit 27 component devices. It has other limitations.
Yes. (In particular, getting all the various counters to agree with each other is a pain ;-)
Steven raises the valid point that multihost operation isn't currently possible; I just don't agree with his solution:
- Activating a drive only on one host is already entirely possible. (can be done by device uuid in initrd for example)
- Activating a RAID device from multiple hosts is still not possible. (Requires way more sophisticated locking support than we currently have)
However, for none-RAID devices like multipathing I believe that activating a drive on multiple hosts should be possible; ie, for these it might not be necessary to scribble to the superblock every time.
(The md patch for 2.4 I sent you already does that; it reconstructs the available paths fully dynamic on startup (by activating all paths present); however it still updates the superblock afterwards)
Anyway, on to the format:
Quoted 15 lines
The code in 2.5.lastest has all the superblock handling factored out so that defining a new format is very straight forward.
I would like to propose a new layout, and to receive comment on it..
My current design looks like:
/* constant array information - 128 bytes */ u32 md_magic u32 major_version == 1 u32 feature_map /* bit map of extra features in superblock */ u32 set_uuid[4] u32 ctime u32 level u32 layout u64 size /* size of component devices, if they are all
Quoted 5 lines
* required to be the same (Raid 1/5 */
u32 chunksize
u32raid_disks
char name[32]
u32 pad1[10];
Looks good so far.
Quoted 5 lines
/* constant this-device information - 64 bytes */u64 address of superblock in device
u32 number of this device in array /* constant over reconfigurations */
u32 device_uuid[4]
What is "address of superblock in device" ? Seems redundant, otherwise you would have been unable to read it, or am missing something?
Special case here might be required for multipathing. (ie, device_uuid == 0)
Quoted 4 lines
u32 pad3[9]
/* array state information - 64 bytes */u32 utime
Timestamps (also above, ctime) are always difficult. Time might not be set correctly at any given time, in particular during early bootup. This field should only be advisory.
Quoted 7 lines
u32 state /* clean, resync-in-progress */ u32 sb_csum u64 events u64 resync-position /* flag in state if this is valid) u32 number of devices u32 pad2[8]
Quoted 5 lines
/* device state information, indexed by 'number of device in array' 4 bytes per device */for each device:
u16 position /* in raid array or0xfffffor a spare. */
u16 state flags /* error detected, in-sync */
u16 != u32; your position flags don't match up. I'd like to be able to take the "position in the superblock" as a mapping here so it can be found in this list, or what is the proposed relationship between the two?
Quoted 6 lines
The interpretation of the 'name' field would be up to the user-space tools and the system administrator.
I imagine having something like:
host:name
where if "host" isn't the current host name, auto-assembly is not tried, and if "host" is the current host name then:
Oh, well. You seem to sort of have Steven's idea here too ;-) In that case, I'd go with the idea of Steven. Make that field a uuid of the host.
Sincerely,
Lars Marowsky-Brée <[email protected]>
Signature · 5 lines
Principal Squirrel SuSE Labs - Research & Development, SuSE Linux AG "If anything can go wrong, it will." "Chance favors the prepared (mind)." -- Capt. Edward A. Murphy -- Louis Pasteur
Quoted 8 lines · On Thursday November 21, [email protected] wrote:
However, for none-RAID devices like multipathing I believe that activating a drive on multiple hosts should be possible; ie, for these it might not be necessary to scribble to the superblock every time.
(The md patch for 2.4 I sent you already does that; it reconstructs the available paths fully dynamic on startup (by activating all paths present); however it still updates the superblock afterwards)
I haven't thought much about multipat I admit.....
Mt feeling is that a multipath superblock should never be updated. Just writen once at creation and left like that (raid0 and linear are much the same) The only lose would be the utime update, and I don't think that is a real lose.
Quoted 8 lines
Quoted 5 lines
/* constant this-device information - 64 bytes */u64 address of superblock in device
u32 number of this device in array /* constant over reconfigurations */
u32 device_uuid[4]What is "address of superblock in device" ? Seems redundant, otherwise you would have been unable to read it, or am missing something?
Suppose I have a device with a partition that ends at the end of the device (and starts at a 64k align location). Then if there is a superblock in the whole device, it will also be in the final partition... but which is right? Storing the location of the superblock allows us to disambiguate.
Quoted 11 lines
Special case here might be required for multipathing. (ie,
device_uuid== 0)Quoted 4 lines
u32 pad3[9]
/* array state information - 64 bytes */u32 utime
Timestamps (also above, ctime) are always difficult. Time might not be set correctly at any given time, in particular during early bootup. This field should only be advisory.
Indeed, they are only advisory.
Quoted 14 lines
Quoted 8 lines
u32 state /* clean, resync-in-progress */ u32 sb_csum u64 events u64 resync-position /* flag in state if this is valid) u32 number of devices u32 pad2[8]Quoted 5 lines
/* device state information, indexed by 'number of device in array' 4 bytes per device */for each device:
u16 position /* in raid array or0xfffffor a spare. */
u16 state flags /* error detected, in-sync */
Quoted 3 lines
u16 != u32; your position flags don't match up. I'd like to be able to take the "position in the superblock" as a mapping here so it can be found in this list, or what is the proposed relationship between the two?
u16 for device flags. u32 (over kill for) array flags. Is there are problem that I am missing?
There is an array of
struct {
u16 position; /* aka role. 0xffff for spare */
u16 state; /* error/insync */ }
in each copy of the superblock. It is indexed by 'number of this device in array' which is constant for any given device despite any configuration changes (until the device is removed from the array). If you have two hot spares, then their 'postition' (aka role) will initially be 0xffff. After a failure, one will be swapped in and it's position becomes (say) 3. Once rebuild is complete, the insync flag is set and the device becomes fully active.
Does that make it clear?
NeilBrown
Quoted 10 lines · Lars Marowsky-Bree
Quoted 9 lines
The md driver in linux uses a 'superblock' written to all devices in a RAID to record the current state and geometry of a RAID and to allow the various parts to be re-assembled reliably.
The current superblock layout is sub-optimal. It contains a lot of redundancy and wastes space. In 4K it can only fit 27 component devices. It has other limitations.
Quoted 10 lines
Yes. (In particular, getting all the various counters to agree with each other is a pain ;-)
Steven raises the valid point that multihost operation isn't currently possible; I just don't agree with his solution:
- Activating a drive only on one host is already entirely possible. (can be done by device uuid in initrd for example)
This technique doesn't work if autostart is set (the partition type is tagged as a RAID volume) or if the user is stupid and starts the wrong uuid by accident. It also requires the user to keep track of which uuids are used by which hosts, which is a pain. Trust me, users will start the wrong RAID volume and have a hard time keeping track of the right UUIDs to asssemble. The technique I use ensures that the RAID volumes can all be set to autostart and only the correct volumes will be started on the correct host.
Quoted 4 lines
- Activating a RAID device from multiple hosts is still not possible. (Requires way more sophisticated locking support than we currently have)
The only application where having a RAID volume shareable between two hosts is useful is for a clustering filesystem (GFS comes to mind). Since RAID is an important need for GFS (if a disk node fails, you don't want ot loose the entire filesystem as you would on GFS) this possibility may be worth exploring.
Since GFS isn't GPL at this point and OpenGFS needs alot of work, I've not spent the time looking at it.
Neil have you thought about sharing an active volume between two hosts and what sort of support would be needed in the superblock?
Thanks
-steve
Quoted 107 lines
However, for none-RAID devices like multipathing I believe that activating a drive on multiple hosts should be possible; ie, for these it might not be necessary to scribble to the superblock every time.
(The md patch for 2.4 I sent you already does that; it reconstructs the available paths fully dynamic on startup (by activating all paths present); however it still updates the superblock afterwards)
Anyway, on to the format:
Quoted 15 lines
The code in 2.5.lastest has all the superblock handling factored out so that defining a new format is very straight forward.
I would like to propose a new layout, and to receive comment on it..
My current design looks like:
/* constant array information - 128 bytes */ u32 md_magic u32 major_version == 1 u32 feature_map /* bit map of extra features in superblock */ u32 set_uuid[4] u32 ctime u32 level u32 layout u64 size /* size of component devices, if they are allQuoted 7 lines
* required to be the same (Raid 1/5 */
u32 chunksize
u32raid_disks
char name[32]
u32 pad1[10];Looks good so far.
Quoted 7 lines
/* constant this-device information - 64 bytes */u64 address of superblock in device
u32 number of this device in array /* constant over reconfigurations */
u32 device_uuid[4]What is "address of superblock in device" ? Seems redundant, otherwise you would have been unable to read it, or am missing something?
Special case here might be required for multipathing. (ie,
device_uuid== 0)Quoted 6 lines
u32 pad3[9]
/* array state information - 64 bytes */u32 utime
Timestamps (also above, ctime) are always difficult. Time might not be set correctly at any given time, in particular during early bootup. This field should only be advisory.
Quoted 7 lines
u32 state /* clean, resync-in-progress */ u32 sb_csum u64 events u64 resync-position /* flag in state if this is valid) u32 number of devices u32 pad2[8]Quoted 7 lines
/* device state information, indexed by 'number of device in array' 4 bytes per device */for each device:
u16 position /* in raid array or0xfffffor a spare. */
u16 state flags /* error detected, in-sync */u16 != u32; your position flags don't match up. I'd like to be able to take the "position in the superblock" as a mapping here so it can be found in this list, or what is the proposed relationship between the two?
Quoted 8 lines
The interpretation of the 'name' field would be up to the user-space tools and the system administrator.
I imagine having something like:
host:name
where if "host" isn't the current host name, auto-assembly is not tried, and if "host" is the current host name then:Oh, well. You seem to sort of have Steven's idea here too ;-) In that case, I'd go with the idea of Steven. Make that field a uuid of the host.
Sincerely,
Lars Marowsky-Brée <[email protected]>
Quoted 2 lines · Steven Dake
Since GFS isn't GPL at this point and OpenGFS needs alot of work, I've not spent the time looking at it.
OCFS is probably the right place to be looking in terms of development in this area right now
( sorrt for the delay in replying, I had a week off, and then a week catching up...)
Quoted 6 lines · On Wednesday November 20, [email protected] wrote:
The only application where having a RAID volume shareable between two hosts is useful is for a clustering filesystem (GFS comes to mind).
Since RAID is an important need for GFS (if a disk node fails, you
don't want ot loose the entire filesystem as you would on GFS) this possibility may be worth exploring.
Quoted 6 lines
Since GFS isn't GPL at this point and OpenGFS needs alot of work, I've not spent the time looking at it.
Neil have you thought about sharing an active volume between two hosts and what sort of support would be needed in the superblock?
I think that the only way shared access could work is if different hosts controlled different slices of the device. The hosts would have to some-how negotiate and record who was managing which bit. It is quite appropriate that this information be stored on the raid array, and quite possibly in a superblock. But I think that this is a sufficiently major departure from how md/raid normally works that I would want it to go in a secondary superblock.
There is 60K free at the end of each device on an MD array. Whoever was implementing this scheme could just have a flag in the main superblock to say "there is a secondary superblock" and then read the info about who owns what from somewhere in that extra 60K
So in short, I think the metadata needed for this sort of thing is sufficiently large and sufficiently unknown that I wouldn't make any allowance for it in the primary superblock.
Does that sound reasonable?
NeilBrown
Quoted 3 lines · Lars Marowsky-Bree
However, for none-RAID devices like multipathing I believe that activating a drive on multiple hosts should be possible; ie, for these it might not be necessary to scribble to the superblock every time.
Again, if you don't use persistent superblock and merely run the
mkraid from your initscripts (or initrd), raid0 and multipath work just fine today.
Joel
Signature · 10 lines
"We will have to repent in this generation not merely for the vitriolic words and actions of the bad people, but for the appalling silence of the good people." - Rev. Dr. Martin Luther King, Jr. Joel Becker Senior Member of Technical Staff Oracle Corporation E-mail: [email protected] Phone: (650) 506-8127