lvmteam/lvm2

Resize an logical volume with ntfs on it errors out since 2.03.22

Closed this issue · 3 comments

jelly commented

Resizing a logical volume with a ntfs filesystem created by ntfs-3g errors out since 2.03.22

Reproducer

Prepare lvm

qemu-img create -f raw lvm.img 100M
sudo losetup --find --show lvm.img
vgcreate testvg /dev/loop0
lvcreate -L50M -ntest testvg
/usr/bin/mkfs.ntfs /dev/mapper/testvg-test

Try to resize

lvresize --verbose --size 25M /dev/mapper/testvg-test

On lvm2 2.03.21 this succeeded

[root@archlinux ~]# lvresize --verbose --size 25M /dev/mapper/testvg-test
  Rounding size to boundary between physical extents: 28.00 MiB.
  WARNING: Reducing active logical volume to 28.00 MiB.
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce testvg/test? [y/n]: y
  Accepted input: [y]
  Reducing logical volume testvg/test to 28.00 MiB
  Size of logical volume testvg/test changed from 52.00 MiB (13 extents) to 28.00 MiB (7 extents).
  Archiving volume group "testvg" metadata (seqno 2).
  Loading table for testvg-test (253:1).
  Suspending testvg-test (253:1) with device flush
  Resuming testvg-test (253:1).
  Logical volume testvg/test successfully resized.
  Creating volume group backup "/etc/lvm/backup/testvg" (seqno 3).

On 2.03.22

[root@archlinux ~]# lvresize --verbose --size 25M /dev/mapper/testvg-test
  Rounding size to boundary between physical extents: 28.00 MiB.
  File system ntfs found on testvg/test.
  File system device usage is not available from libblkid.

Hi

You may likely want to try --fs ignore option.
As this operation leads to potential data loss - there was added this 'extra' option.

This also reproduces with the --force option. Shouldn't --force imply --fs ignore?

# lvresize --force --verbose --size 25M /dev/mapper/testvg-test
  Rounding size to boundary between physical extents: 28.00 MiB.
  File system ntfs found on testvg/test.
  File system device usage is not available from libblkid.

Well the '--fs ignore' is a way to tell lvm2 to ignore anything what is on the storage when reducing a volume - as there were many reports from users who where losing their data during volume reduction too 'easily' - so yeah - when you always use '--fs ignore' it's kind of erasing protection added on lvm2 side.... - but at least we now have journaled commands with 'ignore' being passed as an intentional option...