This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 509123 - lvextend: -r option doesn't work as expected?
lvextend: -r option doesn't work as expected?
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: lvm2 (Show other bugs)
14
x86_64 Linux
low Severity medium
: ---
: ---
Assigned To: Zdenek Kabelac
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-07-01 09:17 EDT by Gianluca Cecchi
Modified: 2012-08-16 19:09 EDT (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-08-16 18:24:21 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Gianluca Cecchi 2009-07-01 09:17:25 EDT
Description of problem:
I'm trying to online extend an ext4 filesystem based on a logical volume device 

Version-Release number of selected component (if applicable):
lvm2-2.02.45-4.fc11.x86_64

How reproducible:
always

Steps to Reproduce:
1.lvextend -l +100%FREE -r /dev/vg_virtfed/lv_root
2.
3.
  
Actual results:
fsadm: Can not fsck device "/dev/mapper/vg_virtfed-lv_root", filesystem mounted on /
  fsadm failed: 1

Expected results:
Performing an on-line resize of /dev/vg_virtfed/lv_root to 3144704 (4k) blocks.
The filesystem on /dev/vg_virtfed/lv_root is now 3144704 blocks long.

Additional info:
I don't know if the -r option is intended only for offline resizing or for online resizing too.
Because if I try "man lvextend" there is no explanation at all for this option.
So it seems the man page version is not in sync with the command itself.
If you run
lvextend --help you get:
  lvextend: Add space to a logical volume

lvextend
	[-A|--autobackup y|n]
	[--alloc AllocationPolicy]
	[-d|--debug]
	[-f|--force]
	[-h|--help]
	[-i|--stripes Stripes [-I|--stripesize StripeSize]]
	{-l|--extents [+]LogicalExtentsNumber[%{VG|PVS|FREE}] |
	 -L|--size [+]LogicalVolumeSize[kKmMgGtTpPeE]}
	[-m|--mirrors Mirrors]
	[-n|--nofsck]
	[-r|--resizefs]
	[-t|--test]
	[--type VolumeType]
	[-v|--verbose]
	[--version]
	LogicalVolume[Path] [ PhysicalVolumePath... ]

On F11 online resize is possible running lvextend (without "-r" option) and then the resize2fs; so possible thae "-r" option could implicitly incorporate the sequence of the two....

[root@virtfed /]# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/vg_virtfed-lv_root
                      10321208   6230208   3566712  64% /
/dev/cciss/c0d0p1       198333     23128    164966  13% /boot
tmpfs                  6104628         0   6104628   0% /dev/shm

[root@virtfed /]# vgs
  VG         #PV #LV #SN Attr   VSize  VFree
  vg_qemu01    1   8   0 wz--n- 52.14G 7.91G
  vg_virtfed   1   2   0 wz--n- 16.00G 2.00G

snip of vgdisplay:
  --- Logical volume ---
  LV Name                /dev/vg_virtfed/lv_root
  VG Name                vg_virtfed
  LV UUID                Emnhwt-IsIZ-Ixph-p9fJ-uOHX-xz7D-MNxb5T
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                10.00 GB
  Current LE             2560
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

[root@virtfed /]# lvextend -l +100%FREE -r /dev/vg_virtfed/lv_root
fsadm: Can not fsck device "/dev/mapper/vg_virtfed-lv_root", filesystem mounted on /
  fsadm failed: 1

[root@virtfed /]# lvextend -l +100%FREE  /dev/vg_virtfed/lv_root
  Extending logical volume lv_root to 12.00 GB
  Logical volume lv_root successfully resized

[root@virtfed /]# mount
/dev/mapper/vg_virtfed-lv_root on / type ext4 (rw)

[root@virtfed /]# resize2fs /dev/vg_virtfed/lv_root 
resize2fs 1.41.4 (27-Jan-2009)
Filesystem at /dev/vg_virtfed/lv_root is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/vg_virtfed/lv_root to 3144704 (4k) blocks.
The filesystem on /dev/vg_virtfed/lv_root is now 3144704 blocks long.

[root@virtfed /]# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/vg_virtfed-lv_root
                      12381360   6232892   5519552  54% /
/dev/cciss/c0d0p1       198333     23128    164966  13% /boot
tmpfs                  6104628         0   6104628   0% /dev/shm
Comment 1 Alasdair Kergon 2009-07-01 09:30:04 EDT
Add -n.

Yes, the man page is out-of-date - let's use this bugzilla to get it updated.
Comment 2 Corey Marthaler 2009-07-08 10:36:08 EDT
So are online resizes supposed to work, or does the man page need to be updated to say that they don't?

[root@grant-02 ~]# lvextend -L 300M -r /dev/grant/mirror 
  Extending 2 mirror images.
fsadm: Can not fsck device "/dev/mapper/grant-mirror", filesystem mounted on /mnt/grant
  fsadm failed: 1

[root@grant-02 ~]# lvextend -L 300M -r -n /dev/grant/mirror 
  Extending 2 mirror images.
  Extending logical volume mirror to 300.00 MB
  Logical volume mirror successfully resized
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/mapper/grant-mirror is mounted on /mnt/grant; on-line resizing required
resize2fs: Filesystem does not support online resizing
fsadm: Resize ext2 failed
  fsadm failed: 1

# The fs size doesn't reflect the lv size:

[root@grant-02 ~]# lvs -a -o +devices
  LV                VG         Attr   LSize   Origin Snap%  Move Log         Copy%  Convert Devices                              
  LogVol00          VolGroup00 -wi-ao  64.56G                                               /dev/sda2(0)                         
  LogVol01          VolGroup00 -wi-ao   9.81G                                               /dev/sda2(2066)                      
  mirror            grant      mwi-ao 300.00M                    mirror_mlog 100.00         mirror_mimage_0(0),mirror_mimage_1(0)
  [mirror_mimage_0] grant      iwi-ao 300.00M                                               /dev/sdb1(0)                         
  [mirror_mimage_1] grant      iwi-ao 300.00M                                               /dev/sdb7(0)                         
  [mirror_mlog]     grant      lwi-ao   4.00M                                               /dev/sdb8(0)                         

[root@grant-02 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       63G  1.9G   58G   4% /
/dev/sda1              99M   13M   82M  13% /boot
tmpfs                 4.0G     0  4.0G   0% /dev/shm
/dev/mapper/grant-mirror
                       97M  1.6M   91M   2% /mnt/grant
Comment 3 Corey Marthaler 2009-07-08 11:36:22 EDT
It looks like the only way this will work, even if the ext2/3 fs is unmounted is to also use the -f flag, without it, it fails.

[root@grant-02 ~]# lvextend -r -n -f -L 10G /dev/grant/mirror 
  Extending 2 mirror images.
  Extending logical volume mirror to 10.00 GB
  Logical volume mirror successfully resized
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/mapper/grant-mirror to 2621440 (4k) blocks.
The filesystem on /dev/mapper/grant-mirror is now 2621440 blocks long.
Comment 4 Corey Marthaler 2009-07-16 10:54:47 EDT
Actually this can appear to deadlock even with the -f flag.

SCENARIO - [fsadm_resize]
Create mirror, add fs, and then resize it while online
grant-01: lvcreate -m 1 -n fsadm_resize -L 500M --nosync mirror_sanity
  WARNING: New mirror won't be synchronised. Don't read what you didn't write!
Placing an ext on fsadm_resize volume
mke2fs 1.39 (29-May-2006)
Resize both the mirror and the fs with lvextend -r option on grant-01
grant-01: lvextend -r -n -f -L 1G /dev/mirror_sanity/fsadm_resize


[...]
read(6, "\340\266a& LVM2 x[5A%r0N*>\1\0\0\0\0\20\0\0\0\0\0\0"..., 512) = 512
lseek(6, 4096, SEEK_SET)                = 4096
write(6, "T\307\341\v LVM2 x[5A%r0N*>\1\0\0\0\0\20\0\0\0\0\0\0"..., 512) = 512
lseek(7, 4096, SEEK_SET)                = 4096
read(7, "\340\266a& LVM2 x[5A%r0N*>\1\0\0\0\0\20\0\0\0\0\0\0"..., 4096) = 4096
lseek(7, 8192, SEEK_SET)                = 8192
read(7, "mirror_sanity {\nid = \"Wv44bU-F2j"..., 4096) = 4096
lseek(7, 4096, SEEK_SET)                = 4096
read(7, "\340\266a& LVM2 x[5A%r0N*>\1\0\0\0\0\20\0\0\0\0\0\0"..., 4096) = 4096
lseek(7, 4096, SEEK_SET)                = 4096
write(7, "T\307\341\v LVM2 x[5A%r0N*>\1\0\0\0\0\20\0\0\0\0\0\0"..., 4096) = 4096
lseek(8, 4096, SEEK_SET)                = 4096
read(8, "\340\266a& LVM2 x[5A%r0N*>\1\0\0\0\0\20\0\0\0\0\0\0"..., 4096) = 4096
lseek(8, 8192, SEEK_SET)                = 8192
read(8, "mirror_sanity {\nid = \"Wv44bU-F2j"..., 4096) = 4096
lseek(8, 4096, SEEK_SET)                = 4096
read(8, "\340\266a& LVM2 x[5A%r0N*>\1\0\0\0\0\20\0\0\0\0\0\0"..., 4096) = 4096
lseek(8, 4096, SEEK_SET)                = 4096
write(8, "T\307\341\v LVM2 x[5A%r0N*>\1\0\0\0\0\20\0\0\0\0\0\0"..., 4096) = 4096
write(3, "2\00064\0\0\0\0\0\0\0\0C\0\0\0\0\36\204Wv44bUF2jUV9N"..., 85) = 85
read(3, "\1\0\0\0\0\0\0\0\0\0\0\0+\0\0\0\0g", 18) = 18
read(3, "rant-03\0\0\0\0\0\0grant-02\0\0\0\0\0\0grant"..., 43) = 43
write(3, "3\0003\0\0\0\0\0\0\0\0\0\22\0\0\0\0\0\4P_mirror_sani"..., 36) = 36
read(3, "\1\0\325\2334\0\0\0\0\0\0\0+\0\0\0\0g", 18) = 18
read(3, "rant-03\0\0\0\0\0\0grant-02\0\0\0\0\0\0grant"..., 43) = 43
stat("/etc/lvm/backup", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
access("/etc/lvm/backup", R_OK|W_OK|X_OK) = 0
uname({sys="Linux", node="grant-01", ...}) = 0
open("/etc/lvm/backup/.lvm_grant-01_10915_1217007811", O_WRONLY|O_CREAT|O_EXCL|O_APPEND, 0666) = 10
fcntl(10, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
fcntl(10, F_GETFL)                      = 0x8401 (flags O_WRONLY|O_APPEND|O_LARGEFILE)
fstat(10, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b95e2ea3000
lseek(10, 0, SEEK_CUR)                  = 0
fsync(10)                               = 0
write(10, "# Generated by LVM2 version 2.02"..., 3221) = 3221
close(10)                               = 0
munmap(0x2b95e2ea3000, 4096)            = 0
rename("/etc/lvm/backup/.lvm_grant-01_10915_1217007811", "/etc/lvm/backup/mirror_sanity.tmp") = 0
rename("/etc/lvm/backup/mirror_sanity.tmp", "/etc/lvm/backup/mirror_sanity") = 0
stat("/etc/lvm/backup/mirror_sanity.tmp", 0x7fff9e2f7580) = -1 ENOENT (No such file or directory)
open("/etc/lvm/backup", O_RDONLY)       = 10
fsync(10)                               = 0
close(10)                               = 0
write(1, "  Logical volume fsadm_resize su"..., 51  Logical volume fsadm_resize successfully resized
) = 51
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x2b95df8c5930) = 10964
wait4(10964, resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/mapper/mirror_sanity-fsadm_resize to 1048576 (1k) blocks.

[never finishes]
Comment 5 Bug Zapper 2010-04-27 11:23:57 EDT
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 6 Alasdair Kergon 2010-04-27 11:37:39 EDT
kabi, what's the current state of this?
Comment 7 Zdenek Kabelac 2010-06-17 08:32:54 EDT
Man pages were updated to show  --nofsck and --resizefs options.  Problem with doing resize of the mirrored root partition is probably beyond the scope of original --resizefs bugzilla.
Comment 8 Bug Zapper 2010-07-30 06:41:55 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 14 development cycle.
Changing version to '14'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 9 Fedora End Of Life 2012-08-16 18:24:27 EDT
This message is a notice that Fedora 14 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 14. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained.  At this time, all open bugs with a Fedora 'version'
of '14' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this 
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen 
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we were unable to fix it before Fedora 14 reached end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" (top right of this page) and open it against that 
version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Note You need to log in before you can comment on or make changes to this bug.