Re: Swapping out for larger disks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Brad Campbell wrote:
[]
> It occurs though that the superblocks would be in the wrong place for
> the new drives and I'm wondering if the kernel or mdadm might not find
> them.

I once had a similar issue.  And wrote a tiny program (a hack, sort of),
to read or write md superblock from/to a component device.  The only
thing it really does is to calculate the superblock location - exactly
as it is done in mdadm.  Here it is:

  http://www.corpit.ru/mjt/mdsuper.c

Usage is like:

 mdsuper read /dev/old-device | mdsuper write /dev/new-device

(or using an intermediate file).

So you're doing like this:

 shutdown array
 for i in all-devices-in-array
   dd if=old-device[i] of=new-device[i] iflag=direct oflag=direct
   mdsuper read old-device | mdsuper write new-device
 done
 assemble-array-on-new-devices
 mdadm -G --size=max /dev/mdx

or something like that.

Note that the program does not work for anything but 0.90
superblocks (i haven't used 1.0 superblocks yet - 0.90 works
for me just fine).  However, it should be trivial to extend
it to handle v1 superblocks too.

Note also that it's trivial to do something like that in shell
too, with blockdev --getsz to get the device size, some shell-
style $((math)), and dd magic.

And 3rd note: using direct as above speeds up the copying *alot*,
while keeping system load at zero.  Without direct, one pair of
disks and the system is doing nothing but the copying...

/mjt
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux