doc:appunti:linux:sa:raid_shrink
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| doc:appunti:linux:sa:raid_shrink [2025/01/03 18:21] – niccolo | doc:appunti:linux:sa:raid_shrink [2025/01/07 10:45] (current) – niccolo | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Shrinking a RAID0 volume to add a smaller device to it ====== | ====== Shrinking a RAID0 volume to add a smaller device to it ====== | ||
| + | |||
| + | **FIXME** Must add the **resize2fs** operation! | ||
| Suppose we have: | Suppose we have: | ||
| Line 23: | Line 25: | ||
| so the size of /dev/sdb7 is 881070080 / 2 = **440535040** kb. | so the size of /dev/sdb7 is 881070080 / 2 = **440535040** kb. | ||
| - | === Get the size of the running component | + | === Get the size of the running component sda7 and RAID device md3 === |
| Get the size (in kb) of the **/ | Get the size (in kb) of the **/ | ||
| Line 48: | Line 50: | ||
| </ | </ | ||
| - | The overhead of the RAID volume is 899608576 - 899476480 = **132096** kb. For safety we add an extra **128** kb for the RAID superblock. | + | The overhead of the RAID volume is 899608576 - 899476480 = **132096** kb. For safety we allow an extra space of **128** kb for the RAID superblock. |
| + | === Calcluate the new array size === | ||
| + | |||
| + | So we can calculate the new array size: | ||
| + | |||
| + | < | ||
| + | new_array_size = new_component_size - raid_overhead - raid_superblock_size | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | 440535040 - 132096 - 128 = 440402816 | ||
| + | </ | ||
| + | |||
| + | It is now possibile to shrink the existing array **/ | ||
| + | |||
| + | < | ||
| + | mdadm --grow /dev/md3 -z 440402816 | ||
| + | </ | ||
| + | |||
| + | Finally we can add the new component to the shrinked array: | ||
| + | |||
| + | < | ||
| + | mdadm /dev/md3 --add /dev/sdb7 | ||
| + | </ | ||
doc/appunti/linux/sa/raid_shrink.1735924888.txt.gz · Last modified: by niccolo
