On 15/7/21 20:40, Christophorus Reyhan wrote:
Hello,
I'm trying to shrink LVM backing block device offline because I
use internal metadata, and I'm following this guide
https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/#s-shrinking-offline
<https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/#s-shrinking-offline>
. But it failed at create-md step.
*Here's the log for first machine (called ol1):*
[root@ol1 drbd.d]# e2fsck -f /dev/drbd0
e2fsck 1.42.9 (28-Dec-2013)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/drbd0: 12/51200 files (0.0% non-contiguous), 109774/204732 blocks
[root@ol1 drbd.d]# drbdadm status
test role:Primary
disk:UpToDate
ol2 role:Secondary
peer-disk:UpToDate
[root@ol1 drbd.d]# resize2fs /dev/drbd0 180M
So the filesystem inside your DRBD device is going to be 180M
resize2fs 1.42.9 (28-Dec-2013)
Resizing the filesystem on /dev/drbd0 to 184320 (1k) blocks.
The filesystem on /dev/drbd0 is now 184320 blocks long.
[root@ol1 drbd.d]# drbdadm down test
[root@ol1 drbd.d]# drbdadm dump-md test > /tmp/metadata
Found meta data is "unclean", please apply-al first
[root@ol1 drbd.d]# drbdadm apply-al test
[root@ol1 drbd.d]# drbdadm dump-md test > /tmp/metadata
[root@ol1 drbd.d]# lvreduce -L 180M /dev/mapper/vgdrbd-vol_drbd
WARNING: Reducing active logical volume to 180.00 MiB.
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce vgdrbd/vol_drbd? [y/n]: y
Size of logical volume vgdrbd/vol_drbd changed from 200.00 MiB (50
extents) to 180.00 MiB (45 extents).
Also, the size of the volume containing both your ext filesystem AND
your DRBD data is going to be 180M....
Logical volume vgdrbd/vol_drbd successfully resized.
[root@ol1 drbd.d]# vi /tmp/metadata
[root@ol1 drbd.d]# blockdev --getsz /dev/mapper/vgdrbd-vol_drbd
368640
[root@ol1 drbd.d]# vi /tmp/metadata
[root@ol1 drbd.d]# drbdadm create-md test --max-peers=5
You want me to create a v09 style flexible-size internal meta data block.
There appears to be a v09 flexible-size internal meta data block
already in place on /dev/vgdrbd/vol_drbd at byte offset 188739584
Do you really want to overwrite the existing meta-data?
[need to type 'yes' to confirm] yes
md_offset 188739584
al_offset 188706816
bm_offset 188674048
Found ext3 filesystem
184320 kB data area apparently used
184252 kB left usable by current configuration
As per the messages, there isn't enough space to preserve both your
filesystem data AND add the DRBD data. Either resize your filesystem to
179M, resize the LV to 180M, and then after everything is working again,
you can resize the filesystem to take all available space, and it should
increase to 184252kB or 179.9+ MB
I'm pretty sure the DRBD manual has some details on how to calculate
exactly how much space you will need to leave available for the DRBD
metadata, but I usually just do the above (make the filesystem smaller
than my target, and then after DRBD has been resized, increase the FS to
take up any extra space).
Hope that helps...
Regards,
Adam
_______________________________________________
Star us on GITHUB: https://github.com/LINBIT
drbd-user mailing list
[email protected]
https://lists.linbit.com/mailman/listinfo/drbd-user