blob: fe39f45df23d1bb4e96f2993b24335d56d9cb28d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#!/usr/bin/env bash
# Copyright (C) 2016 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
# Excersize resize of filesystem when size of LV already matches
# https://bugzilla.redhat.com/1354396
SKIP_WITH_LVMPOLLD=1
. lib/inittest
FSCK=${FSCK-fsck}
MKFS=${MKFS-mkfs.ext3}
RESIZEFS=${RESIZEFS-resize2fs}
which $FSCK || skip
which $MKFS || skip
which $RESIZEFS || skip
aux prepare_vg 2 20
lvcreate -l100%FREE -n $lv1 $vg
lvdev="$DM_DEV_DIR/$vg/$lv1"
lvs -a $vg
"$MKFS" "$lvdev"
# this should resolve to resize to same actual size
not lvreduce -l-100%FREE $vg/$lv1
not lvreduce -r -f -l-100%FREE $vg/$lv1
"$FSCK" -n "$lvdev"
# size should remain the same
# lvresize fails with same result with or without -r
not lvextend -l+100%FREE $vg/$lv1
not lvextend -r -f -l+100%FREE $vg/$lv1
"$FSCK" -n "$lvdev"
#lvchange -an $vg/$lv1
not lvresize -l+100%FREE $vg/$lv1
not lvresize -r -f -l+100%FREE $vg/$lv1
"$FSCK" -n "$lvdev"
# Check there is really file system resize happening
# even when LV itself has still the same size
"$RESIZEFS" -f "$lvdev" 20000
"$FSCK" -n "$lvdev" | tee out
grep "20000 blocks" out
SIZE=$(get lv_field $vg/$lv1 size)
not lvresize -l-100%FREE $vg/$lv1
not lvresize -r -f -l-100%FREE $vg/$lv1
test "$SIZE" = "$(get lv_field $vg/$lv1 size)"
"$FSCK" -n "$lvdev" | tee out
grep -v "20000 blocks" out
# Also check it fails when the user 'resize' volume without
# resizing fs and then retries with '-r'.
# The first lvreduce intentionally ignores the fs and intentionally
# corrupts the fs so that the second lvresize will fail when it runs
# fsck.
lvreduce -f --fs ignore -l50%VG $vg/$lv1
fail lvresize -r -f -l20%VG $vg/$lv1
lvremove -ff $vg
|