Ubuntu: Changing the stripe size of a striped LVM volume

Question: How can we change the stripe size of an existing logical volume?

The logical volume (LV) must be converted to type RAID5 and then back to type striped to change the stripe size. An example is shown on how to change the stripe size of a logical volume with a default stripe size of 64K to a stripe size of 128K.

1. First convert to type RAID5:

# lvconvert --type raid5 vgtest/stripelv
# lvs -ao +lv_full_name,devices,stripe_size

2. Then, reshape the RAID5, changing the stripe size:

# lvconvert -I 128 vgtest/stripelv
# lvs -ao +lv_full_name,devices,stripe_size

Note that this requires a small amount of extra space for the reshaping, typically about 1 extent. This extra space allows blocks in a stripe to be updated safely, and not be corrupted in case of a crash. If a crash occurs, reshaping can simply be restarted.

3. Now that we have modified the stripe size, we can convert back to type striped, where you will see that the stripe size is modified.

# lvconvert --type striped vgtest/stripelv
# lvs -ao +lv_full_name,devices,stripe_size

Final Word

For more information on reshaping and takeover, please see man lvmraid:

# man lvmraid

Also, after each type conversion, from stripe to raid, and then back to stripe, ensure that the conversion has completely finished before moving on. This can be monitored with the ‘watch lvs -o sync_percent [logical_volume]’ command.

# watch lvs -o sync_percent [logical_volume]
Related Post