1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00
lvm2/test/shell/relative-sign-options.sh
David Teigland 264827cb98 lvresize: add new options and defaults for fs handling
The new option "--fs String" for lvresize/lvreduce/lvextend
controls the handling of file systems before/after resizing
the LV.  --resizefs is the same as --fs resize.

The new option "--fsmode String" can be used to control
mounting and unmounting of the fs during resizing.

Possible --fs values:

checksize
  Only applies to reducing size; does nothing for extend.
  Check the fs size and reduce the LV if the fs is not using
  the affected space, i.e. the fs does not need to be shrunk.
  Fail the command without reducing the fs or LV if the fs is
  using the affected space.

resize
  Resize the fs using the fs-specific resize command.
  This may include mounting, unmounting, or running fsck.
  See --fsmode to control mounting behavior, and --nofsck to
  disable fsck.

resize_fsadm
  Use the old method of calling fsadm to handle the fs
  (deprecated.) Warning: this option does not prevent lvreduce
  from destroying file systems that are unmounted (or mounted
  if prompts are skipped.)

ignore
  Resize the LV without checking for or handling a file system.
  Warning: using ignore when reducing the LV size may destroy the
  file system.

Possible --fsmode values:

manage
  Mount or unmount the fs as needed to resize the fs,
  and attempt to restore the original mount state at the end.

nochange
  Do not mount or unmount the fs. If mounting or unmounting
  is required to resize the fs, then do not resize the fs or
  the LV and fail the command.

offline
  Unmount the fs if it is mounted, and resize the fs while it
  is unmounted. If mounting is required to resize the fs,
  then do not resize the fs or the LV and fail the command.

Notes on lvreduce:

When no --fs or --resizefs option is specified:
. lvextend default behavior is fs ignore.
. lvreduce default behavior is fs checksize
  (includes activating the LV.)

With the exception of --fs resize_fsadm|ignore, lvreduce requires
the recent libblkid fields FSLASTBLOCK and FSBLOCKSIZE.
FSLASTBLOCK*FSBLOCKSIZE is the last byte used by the fs on the LV,
which determines if reducing the fs is necessary.
2022-09-13 15:15:05 -05:00

81 lines
2.1 KiB
Bash

#!/usr/bin/env bash
# Copyright (C) 2017 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
test_description='Exercise toollib process_each_lv'
SKIP_WITH_LVMPOLLD=1
. lib/inittest
aux prepare_vg 1 256
lvcreate -an -n $lv1 -l4 $vg
lvcreate -an -n $lv2 -L4 $vg
lvcreate -an -n $lv3 -l+4 $vg
lvcreate -an -n $lv4 -L+4 $vg
not lvcreate -n $lv5 -l-4 $vg
not lvcreate -n $lv5 -L-4 $vg
lvremove $vg/$lv1
lvremove $vg/$lv2
lvremove $vg/$lv3
lvremove $vg/$lv4
lvcreate -an -n $lv1 -l4 $vg
lvresize -y -l8 $vg/$lv1
lvresize -y -L16 $vg/$lv1
lvresize -y -l+1 $vg/$lv1
lvresize -y -L+1 $vg/$lv1
lvresize -y --fs ignore -l-1 $vg/$lv1
lvresize -y --fs ignore -L-1 $vg/$lv1
lvcreate -an -n $lv2 -l4 $vg
lvextend -y -l8 $vg/$lv2
lvextend -y -L16 $vg/$lv2
lvextend -y -l+1 $vg/$lv2
lvextend -y -L+1 $vg/$lv2
not lvextend -y -l-1 $vg/$lv2
not lvextend -y -L-1 $vg/$lv2
lvcreate -an -n $lv3 -l64 $vg
lvreduce -y --fs ignore -l32 $vg/$lv3
lvreduce -y --fs ignore -L8 $vg/$lv3
lvreduce -y --fs ignore -l-1 $vg/$lv3
lvreduce -y --fs ignore -L-1 $vg/$lv3
not lvreduce -y --fs ignore -l+1 $vg/$lv3
not lvreduce -y --fs ignore -L+1 $vg/$lv3
# relative with percent extents
lvcreate -an -n $lv6 -l+100%FREE $vg
lvremove $vg/$lv6
lvcreate -an -n $lv6 -l1 $vg
lvextend -y -l+100%FREE $vg/$lv6
lvremove $vg/$lv6
lvcreate -an -n $lv6 -l1 $vg
lvresize -y -l+100%FREE $vg/$lv6
lvremove $vg/$lv6
if aux have_thin 1 0 0 ; then
# relative poolmetadatasize
lvcreate --type thin-pool -L64 --poolmetadatasize 32 -n $lv7 $vg
lvresize --poolmetadatasize 64 $vg/$lv7
lvresize --poolmetadatasize +8 $vg/$lv7
not lvresize -y --poolmetadatasize -8 $vg/$lv7
lvextend --poolmetadatasize +4 $vg/$lv7
not lvextend -y --poolmetadatasize -8 $vg/$lv7
fi
vgremove -y $vg