By default, LVM will sync the two mirrors of a logical volume on
creation. This is I/O intensive and it takes a long time though, so we
tell it not to with --nosync. The next default behavior is to create a
mirror log which says what portions of the mirrors are in sync. But
then if a disk backing a mirror log fails, we have to deal with
resyncing the mirrors at each reboot.
This commit tells LVM to use a mirrored mirror log, which will use
approximately 4MB of extra space, but means we'll never have to
sync mirrors, ever.
Change-Id: I6586ced4e7e66ae79ae134406a4c633f8fbc8602
cmd = ['lvcreate', '-n', name, self.vg_name, '-L', size_str]
if mirror_count > 0:
- cmd.extend(['-m', mirror_count, '--nosync'])
+ cmd.extend(['-m', mirror_count, '--nosync',
+ '--mirrorlog mirrored'])
terras = int(size_str[:-1]) / 1024.0
if terras >= 1.5:
rsize = int(2 ** math.ceil(math.log(terras) / math.log(2)))