Skip to contentSkip to conversation

Shrinking raid array

DISCUSSION Phillip Susi 2 participants 8 messages Feb 12, 2013 – Feb 13, 2013 MD RAID

lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm working on shrinking a raid array and need some clarification on where the metadata goes and how large it is. I have used -G with -Z and -z to reduce the used size of each disk, but the man page says you need some extra space at the end of the disk for the metadata ( format 1.0 ), but doesn't specify exactly how much. I need to know what the exact size of the reduced partition should be.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJRGmVUAAoJEJrBOlT6nu7591gIAIxoEWfN0L84UhaEwbKjzaOi MXeCEdMjiGi5a4DCkl8FkKsrAHDHrmFKJ5hBr8u6DfS8rHyX7CmdUz5aVW1VhK/e /bo44Vsrl/Tj7nqBYX4rxm3yhPzN17tTGKcf0lunWXFg9Ykv4Gc4EefzSsjTPbZf oHepjklaik2tff3JCuxP7nv3I97BULmVvKJFKgeooK9QB6F5pRY1LnjRNhM91CKN zkvoi3mitmK6fGZ+N7PUiogv2TczvX6m+yeNFb7Qw7opsrdErh7TH752efeKQ4bU Iwomx1kYZT2k2swo+SahkZr58bfBkTzG5KZXUojEXO/pTX1vJFg+FOoVZ5m0bLY= =k41W
-----END PGP SIGNATURE-----

#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 7 lines · Phillip Susi

I'm working on shrinking a raid array and need some clarification on where the metadata goes and how large it is. I have used -G with -Z and -z to reduce the used size of each disk, but the man page says you need some extra space at the end of the disk for the metadata ( format 1.0 ), but doesn't specify exactly how much. I need to know what the exact size of the reduced partition should be.

I just noticed that reducing the used dev size has not moved the metadata, so it is looking like it just isn't possible to shrink the md partition with metadata format 1.0?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJRGnBSAAoJEJrBOlT6nu75u0AIAJybUCaf02hyvAbDUD3JmjIA MXW8yapXks4Xta5YX7MQlPJu0yLniw++0W1Y76vJ1gEjqN+JNUMN2k4CVeGLSwz+ UznaLejNkGiZ9+n3e1Fq1LKu/6J4Z16AC+If+1kmVpm5hDPkbJ3cPp6ZcfgSZhIp /diiJrm7cdGMxtMXTqYPPhVwn9QmxNyoLNdN3OdPpKaNadkNksYi/AnbUmGEhuzx q9TNIJwW4v0WZTZ8AevHvFlgFcgk41pdh8nN6ta/EKRzcfj32ro1HrA1P8zdp6gr QYTzf+UHa27kZGNKrgD7dgFWFlsZf7zQ6WTV3iKoy/HQIARFzdmonVBTTfg6D8A= =UCSK
-----END PGP SIGNATURE-----

#2 lore raw
Quoted 1 line · Phillip Susi

I just noticed that reducing the used dev size has not moved the metadata, so it is looking like it just isn't possible to shrink the md partition with metadata format 1.0?

From "man mdadm"

"The different sub-versions store the superblock at different locations on the device, either at the end (for 1.0), at the start (for 1.1) or 4K from the start (for 1.2)"

I don't really see how it could be shrunk with a superblock at the end, then you wouldn't be able to find it next time...

Signature · 1 line
Mikael Abrahamsson    email: [email protected]
#3 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 6 lines · Mikael Abrahamsson
Quoted 3 lines · Phillip Susi

I just noticed that reducing the used dev size has not moved the metadata, so it is looking like it just isn't possible to shrink the md partition with metadata format 1.0?

Quoted 8 lines

From "man mdadm"

"The different sub-versions store the superblock at different locations on the device, either at the end (for 1.0), at the start (for 1.1) or 4K from the start (for 1.2)"

I don't really see how it could be shrunk with a superblock at the end, then you wouldn't be able to find it next time...

You move the superblock, then shrink the partition...

But it looks like mdadm doesn't move the superblock even though it no longer is using the full partition.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJRGoXXAAoJEJrBOlT6nu75N+YH/R/om3wi5yJ/DidGWJFxd5J2 WuLV0oUqggDZxjM32/usuZwzVCnPnvXDmd9HKavf9Ko8gVnMUsJeVtv6fQDmr4uy IpPyrHcYa80am3hX5maGt+orJgk4kP4sc2x4Ya/OYBHfiTYn704+bUmP8znrJ5CG rBzqWaRsdQy4v+ps/7l3VQuyJhDxEoNjz4NDAZC8wWqxoclJVtAE9uxPbdpYRLSV +SlY76LIoea3YHXYLLu6vXJpQsaDalyVAzuDbEspJQ/fvjUTncCGicBvG/obbGsW 9hrftYoNnhEc7PmRPvbPFW7f6EkpPMbTo/FLhB0r8Fw0AS0AYG12UACH+zO2Rjg= =hvFb
-----END PGP SIGNATURE-----

#4 lore raw
Quoted 1 line · Phillip Susi

You move the superblock, then shrink the partition...

As far as I know, mdadm has no code to shrink partitions?

Quoted 2 lines

But it looks like mdadm doesn't move the superblock even though it no longer is using the full partition.

I think that is perfectly reasonable. Otherwise the superblock wouldn't be found next time if the partition wasn't resized.

Signature · 1 line
Mikael Abrahamsson    email: [email protected]
#5 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 5 lines · Mikael Abrahamsson
Quoted 1 line · Phillip Susi

You move the superblock, then shrink the partition...

As far as I know, mdadm has no code to shrink partitions?

Of course not, you would use fdisk or parted or whatever else to do that.

Quoted 5 lines
Quoted 2 lines

But it looks like mdadm doesn't move the superblock even though it no longer is using the full partition.

I think that is perfectly reasonable. Otherwise the superblock wouldn't be found next time if the partition wasn't resized.

Yes, but the way it is now the superblock won't be found if the partition *is* resized. What is the use of reducing the amount of the partition mdadm is using if you can't then shrink the partition itself?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJRGpRxAAoJEJrBOlT6nu750k8IAMwCbeO6rhWP+6pg0nPmgeyI HM5E1X9bJTqV9MfmvSKYjL8QBp6flYqd0bm++lbeOxFiujxKQ5QVSHIF8no6psVe wLLeGy3ltFJ41QnuQAIf2YwR0jhUAd2Wxoeqwq7pnGnSVb8er3Y2ACuj7SNN7SwL pe8DbrUQGpDydnLSH/Rzj/ioQ8BtWt6Uq/xZ8+3j5t3pqAJGmdnQroRJJ6W+0oKN IwK7IK0SVP8fExSjDM2Lo3YfFXfgpan81GADNwYo5ZwEtPTfxvcuXrGVLbjXyN4o Ae6DAMpNihSDKzTXvpPqnzimqpMDtue01zQQdDgkYfcheoQ1DsHnfO8aCnS/mIg= =i9j8
-----END PGP SIGNATURE-----

#6 lore raw
Quoted 1 line · Phillip Susi

Yes, but the way it is now the superblock won't be found if the partition *is* resized. What is the use of reducing the amount of the partition mdadm is using if you can't then shrink the partition itself?

It makes sense if you for some reason want to use a smaller component drive (thinking mostly of older drives where 36 or 73GB didn't mean an exact size between manufacturers and you happened to create the array on a larger drive than you now have available.

Anyhow, I can see that what you're looking for is useful as well but I also believe it should be done through a special option and I imagine it should also output information regarding where the partition should now end (to use in fdisk) so mdadm can find the superblock next time.

Signature · 1 line
Mikael Abrahamsson    email: [email protected]
#7 lore raw
Quoted 1 line · Mikael Abrahamsson

Anyhow, I can see that what you're looking for is useful as well but I also believe it should be done through a special option and I imagine it should also output information regarding where the partition should now end (to use in fdisk) so mdadm can find the superblock next time.

Actually, in addition to this, I also believe that there should be some kind of superblock at the end of the current partition that points to the location of the "new" moved superblock, so that things work even if you do not change the partition size.

Signature · 1 line
Mikael Abrahamsson    email: [email protected]