Skip to contentSkip to conversation

LVM Problems :)

linux-lvm Christian Reiss 5 participants 14 messages Feb 13, 2004 – Feb 16, 2004

lore
Share & tools
lore
#0 lore raw

Greetings!

I am trying to dissolve a running LVM, so i am doing the e2fsadm, lvreduce, pvmove thingy. But ever since I removed the first hdd, I am unable to resize the lvm any more. The error can be seen below, with e2fsadm. I also included the vg&lvdisplay commands.

I am running the LVM1 sources (non-cvs, approx mid last year), as i am unable to run LVM2 (need to downgrade kernel to 2.4.22 (no patch included in lvm2 for 2.4.23)). Also, I am (too dumb/unable) to locate a e2fsadm alike tool for lvm2, as e2fsadm needs the lvm-tab thingy, which lvm2 no longer provides.

Any help is greatly appreciated. :)

-Christian.

::::::::::::::::::
::: vgdisplay ::::

--- Volume group ---

VG Name               share
VG Access             read/write
VG Status             available/NOT resizable
VG #                  0
MAX LV                256
Cur LV                1
Open LV               1
MAX LV Size           2 TB
Max PV                256
Cur PV                11
Act PV                11
VG Size               1.12 TB
PE Size               32 MB
Total PE              36668
Alloc PE / Size       34108 / 1.04 TB
Free  PE / Size       2560 / 80 GB
VG UUID               PSYbaQ-bl8d-xvHp-6re2-hoKd-9mE5-Wa5Tqz

:::::::::::::::
:: lvdisplay ::

--- Logical volume ---

LV Name                /dev/share/data
VG Name                share
LV Write Access        read/write
LV Status              available
LV #                   1
# open                 1
LV Size                1.04 TB
Current LE             34108
Allocated LE           34108
Allocation             next free
Read ahead sectors     1024
Block device           58:0

:::::::::::::
:: e2fsadm ::

e2fsadm -L-10G /dev/share/data
e2fsadm -- logical volume size for "/dev/share/data" invalid

:::::::::::
:: df -h ::

Filesystem            Size  Used Avail Use% Mounted on
/dev/share/data       941G  910G   32G  97% /share/filebase
Signature · 5 lines
Christian Reiss <[email protected]>
demonserver.de

Key fingerprint = 2999 B7CD A218 06DF D658  5BE3 18B6 B232 02FF 71B2
Public Key can be obtained here: http://www.demonlord.de/pgp.txt
#1 lore raw
Quoted 6 lines · Christian Reiss

I am trying to dissolve a running LVM, so i am doing the e2fsadm, lvreduce, pvmove thingy. But ever since I removed the first hdd, I am unable to resize the lvm any more. The error can be seen below, with e2fsadm. I also included the vg&lvdisplay commands.

Quoted 6 lines

I am running the LVM1 sources (non-cvs, approx mid last year), as i am unable to run LVM2 (need to downgrade kernel to 2.4.22 (no patch included in lvm2 for 2.4.23)). Also, I am (too dumb/unable) to locate a e2fsadm alike tool for lvm2, as e2fsadm needs the lvm-tab thingy, which lvm2 no longer provides.

Well, AFAIK, the 2.4.22 patches work fine with 2.4.23. As far as e2fsadm, there is currently no equivilant for LVM2, so you have to do the resizing by hand (shrink fs then shrink lv).

regards,

Signature · 11 lines
AJ Lewis                                   Voice:  612-638-0500
Red Hat Inc.                               E-Mail: [email protected]
720 Washington Ave. SE, Suite 200
Minneapolis, MN 55414

Current GPG fingerprint = FE77 4B43 6A9B F982 A731  02FA 2BF5 7574 294A AA5A
Grab the key at: http://people.redhat.com/alewis/gpg.html or one of the
many keyservers out there...
-----Begin Obligatory Humorous Quote----------------------------------------
Computers make very fast, very accurate mistakes.
-----End Obligatory Humorous Quote------------------------------------------
#2 lore raw
In reply to Christian Reiss

Christian,

the size of your filesystem and logical volume differs already. That's why e2fsadm fails.
Did you eventually run resize2fs in order to shrink the filesystem ?

Your logical volume size is 1091456MB (32MB/PE * 34108 PE) but your filesystem size is 963584GB (941GB * 1024MB/GB; check with "tune2fs -l" and look for the block count and block size to calculate this correctly).

In case the result shows, that your filesystem is already smaller than the LV, lvreduce the logical volume appropriately.

Use the block count * block size result and round it up to the next PE!

Regards,
Heinz -- The LVM Guy --

Quoted 62 lines · Christian Reiss

Greetings!

I am trying to dissolve a running LVM, so i am doing the e2fsadm, lvreduce, pvmove thingy. But ever since I removed the first hdd, I am unable to resize the lvm any more. The error can be seen below, with e2fsadm. I also included the vg&lvdisplay commands.

I am running the LVM1 sources (non-cvs, approx mid last year), as i am unable to run LVM2 (need to downgrade kernel to 2.4.22 (no patch included in lvm2 for 2.4.23)). Also, I am (too dumb/unable) to locate a e2fsadm alike tool for lvm2, as e2fsadm needs the lvm-tab thingy, which lvm2 no longer provides.

Any help is greatly appreciated. :)

-Christian.

::::::::::::::::::
::: vgdisplay ::::

--- Volume group ---

VG Name               share
VG Access             read/write
VG Status             available/NOT resizable
VG #                  0
MAX LV                256
Cur LV                1
Open LV               1
MAX LV Size           2 TB
Max PV                256
Cur PV                11
Act PV                11
VG Size               1.12 TB
PE Size               32 MB
Total PE              36668
Alloc PE / Size       34108 / 1.04 TB
Free  PE / Size       2560 / 80 GB
VG UUID               PSYbaQ-bl8d-xvHp-6re2-hoKd-9mE5-Wa5Tqz

:::::::::::::::
:: lvdisplay ::

--- Logical volume ---

LV Name                /dev/share/data
VG Name                share
LV Write Access        read/write
LV Status              available
LV #                   1
# open                 1
LV Size                1.04 TB
Current LE             34108
Allocated LE           34108
Allocation             next free
Read ahead sectors     1024
Block device           58:0

:::::::::::::
:: e2fsadm ::

Quoted 16 lines

e2fsadm -L-10G /dev/share/data
e2fsadm -- logical volume size for "/dev/share/data" invalid

:::::::::::
:: df -h ::

Filesystem            Size  Used Avail Use% Mounted on
/dev/share/data       941G  910G   32G  97% /share/filebase
Signature · 5 lines
Christian Reiss <[email protected]>
demonserver.de

Key fingerprint = 2999 B7CD A218 06DF D658  5BE3 18B6 B232 02FF 71B2
Public Key can be obtained here: http://www.demonlord.de/pgp.txt

*** Software bugs are stupid.
Nevertheless it needs not so stupid people to solve them ***

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Heinz Mauelshagen Red Hat, Inc.
Consulting Development Engineer Am Sonnenhang 11
56242 Marienrachdorf Germany
[email protected] +49 2626 141200

                                                       FAX 924446

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw

Hi there!

Big thanks for the very fast answer!!
Much appreciated!

Just to be VERY sure, tune2fs -l says:

tune2fs -l /dev/share/data
tune2fs 1.32 (09-Nov-2002)

Filesystem volume name:   <none>
Last mounted on:          <not available>
Filesystem UUID:          e89bf0d8-31fc-4ef0-945a-8cc4bb0c1d4c
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      filetype sparse_super large_file
Default mount options:    (none)
Filesystem state:         not clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              125288448
Block count:              250576896
Reserved block count:     0
Free blocks:              8128738
Free inodes:              125210458
First block:              0
Block size:               4096
Fragment size:            4096
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         16384
Inode blocks per group:   512
Filesystem created:       Fri May 30 17:14:27 2003
Last mount time:          Fri Feb 13 14:58:30 2004
Last write time:          Fri Feb 13 14:58:30 2004
Mount count:              12
Maximum mount count:      20
Last checked:             Thu Feb 12 18:53:36 2004
Check interval:           15552000 (6 months)
Next check after:         Tue Aug 10 19:53:36 2004
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               128

----

So What lvreduce size should i use to shrink it? I better have a guru look over it, better safe than sorry :)

-Christian.

Quoted 122 lines · Heinz Mauelshagen

Christian,

the size of your filesystem and logical volume differs already. That's why e2fsadm fails.
Did you eventually run resize2fs in order to shrink the filesystem ?

Your logical volume size is 1091456MB (32MB/PE * 34108 PE) but your filesystem size is 963584GB (941GB * 1024MB/GB; check with "tune2fs -l" and look for the block count and block size to calculate this correctly).

In case the result shows, that your filesystem is already smaller than the LV, lvreduce the logical volume appropriately.

Use the block count * block size result and round it up to the next PE!

Regards,
Heinz -- The LVM Guy --

Quoted 62 lines · Christian Reiss

Greetings!

I am trying to dissolve a running LVM, so i am doing the e2fsadm, lvreduce, pvmove thingy. But ever since I removed the first hdd, I am unable to resize the lvm any more. The error can be seen below, with e2fsadm. I also included the vg&lvdisplay commands.

I am running the LVM1 sources (non-cvs, approx mid last year), as i am unable to run LVM2 (need to downgrade kernel to 2.4.22 (no patch included in lvm2 for 2.4.23)). Also, I am (too dumb/unable) to locate a e2fsadm alike tool for lvm2, as e2fsadm needs the lvm-tab thingy, which lvm2 no longer provides.

Any help is greatly appreciated. :)

-Christian.

::::::::::::::::::
::: vgdisplay ::::

--- Volume group ---

VG Name               share
VG Access             read/write
VG Status             available/NOT resizable
VG #                  0
MAX LV                256
Cur LV                1
Open LV               1
MAX LV Size           2 TB
Max PV                256
Cur PV                11
Act PV                11
VG Size               1.12 TB
PE Size               32 MB
Total PE              36668
Alloc PE / Size       34108 / 1.04 TB
Free  PE / Size       2560 / 80 GB
VG UUID               PSYbaQ-bl8d-xvHp-6re2-hoKd-9mE5-Wa5Tqz

:::::::::::::::
:: lvdisplay ::

--- Logical volume ---

LV Name                /dev/share/data
VG Name                share
LV Write Access        read/write
LV Status              available
LV #                   1
# open                 1
LV Size                1.04 TB
Current LE             34108
Allocated LE           34108
Allocation             next free
Read ahead sectors     1024
Block device           58:0

:::::::::::::
:: e2fsadm ::

Quoted 16 lines

e2fsadm -L-10G /dev/share/data
e2fsadm -- logical volume size for "/dev/share/data" invalid

:::::::::::
:: df -h ::

Filesystem            Size  Used Avail Use% Mounted on
/dev/share/data       941G  910G   32G  97% /share/filebase
Signature · 5 lines
Christian Reiss <[email protected]>
demonserver.de

Key fingerprint = 2999 B7CD A218 06DF D658  5BE3 18B6 B232 02FF 71B2
Public Key can be obtained here: http://www.demonlord.de/pgp.txt

*** Software bugs are stupid.
Nevertheless it needs not so stupid people to solve them ***

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Heinz Mauelshagen Red Hat, Inc.
Consulting Development Engineer Am Sonnenhang 11
56242 Marienrachdorf Germany
[email protected] +49 2626 141200

                                                       FAX 924446

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

Signature · 5 lines
Christian Reiss <[email protected]>
demonserver.de

Key fingerprint = 2999 B7CD A218 06DF D658  5BE3 18B6 B232 02FF 71B2
Public Key can be obtained here: http://www.demonlord.de/pgp.txt
#4 lore raw
In reply to Heinz Mauelshagen

Greetings again,

Curious, I replied, but did not recive a copy of my reply, maybe it got lost in the internet? :) Killed by a rogue lvm, I assume ;) - If this was/is only me missing my reply, then I am deeply sorry for spamming - not intentionally, really.

---

Hi there!

Big thanks for the very fast answer!!
Much appreciated!

Just to be VERY sure, tune2fs -l says:

tune2fs -l /dev/share/data
tune2fs 1.32 (09-Nov-2002)

Filesystem volume name:   <none>
Last mounted on:          <not available>
Filesystem UUID:          e89bf0d8-31fc-4ef0-945a-8cc4bb0c1d4c
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      filetype sparse_super large_file
Default mount options:    (none)
Filesystem state:         not clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              125288448
Block count:              250576896
Reserved block count:     0
Free blocks:              8128738
Free inodes:              125210458
First block:              0
Block size:               4096
Fragment size:            4096
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         16384
Inode blocks per group:   512
Filesystem created:       Fri May 30 17:14:27 2003
Last mount time:          Fri Feb 13 14:58:30 2004
Last write time:          Fri Feb 13 14:58:30 2004
Mount count:              12
Maximum mount count:      20
Last checked:             Thu Feb 12 18:53:36 2004
Check interval:           15552000 (6 months)
Next check after:         Tue Aug 10 19:53:36 2004
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               128

----

So What lvreduce size should i use to shrink it? I better have a guru look over it, better safe than sorry

-Christian.

Quoted 123 lines · Heinz Mauelshagen

Christian,

the size of your filesystem and logical volume differs already. That's why e2fsadm fails.
Did you eventually run resize2fs in order to shrink the filesystem ?

Your logical volume size is 1091456MB (32MB/PE * 34108 PE) but your filesystem size is 963584GB (941GB * 1024MB/GB; check with "tune2fs -l" and look for the block count and block size to calculate this correctly).

In case the result shows, that your filesystem is already smaller than the LV, lvreduce the logical volume appropriately.

Use the block count * block size result and round it up to the next PE!

Regards,
Heinz -- The LVM Guy --

Quoted 72 lines · Christian Reiss

Greetings!

I am trying to dissolve a running LVM, so i am doing the e2fsadm, lvreduce, pvmove thingy. But ever since I removed the first hdd, I am unable to resize the lvm any more. The error can be seen below, with e2fsadm. I also included the vg&lvdisplay commands.

I am running the LVM1 sources (non-cvs, approx mid last year), as i am unable to run LVM2 (need to downgrade kernel to 2.4.22 (no patch included in lvm2 for 2.4.23)). Also, I am (too dumb/unable) to locate a e2fsadm alike tool for lvm2, as e2fsadm needs the lvm-tab thingy, which lvm2 no longer provides.

Any help is greatly appreciated.

-Christian.

::::::::::::::::::
::: vgdisplay ::::

--- Volume group ---

VG Name               share
VG Access             read/write
VG Status             available/NOT resizable
VG #                  0
MAX LV                256
Cur LV                1
Open LV               1
MAX LV Size           2 TB
Max PV                256
Cur PV                11
Act PV                11
VG Size               1.12 TB
PE Size               32 MB
Total PE              36668
Alloc PE / Size       34108 / 1.04 TB
Free  PE / Size       2560 / 80 GB
VG UUID               PSYbaQ-bl8d-xvHp-6re2-hoKd-9mE5-Wa5Tqz

:::::::::::::::
:: lvdisplay ::

--- Logical volume ---

LV Name                /dev/share/data
VG Name                share
LV Write Access        read/write
LV Status              available
LV #                   1
# open                 1
LV Size                1.04 TB
Current LE             34108
Allocated LE           34108
Allocation             next free
Read ahead sectors     1024
Block device           58:0

:::::::::::::
:: e2fsadm ::

e2fsadm -L-10G /dev/share/data
e2fsadm -- logical volume size for "/dev/share/data" invalid

:::::::::::
:: df -h ::

Filesystem            Size  Used Avail Use% Mounted on
/dev/share/data       941G  910G   32G  97% /share/filebase
Quoted 6 lines

--
Christian Reiss <[email protected]>
demonserver.de

Key fingerprint = 2999 B7CD A218 06DF D658 5BE3 18B6 B232 02FF 71B2 Public Key can be obtained here: http://www.demonlord.de/pgp.txt

*** Software bugs are stupid.
Nevertheless it needs not so stupid people to solve them ***

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Heinz Mauelshagen Red Hat, Inc.
Consulting Development Engineer Am Sonnenhang 11
56242 Marienrachdorf Germany
[email protected] +49 2626 141200

                                                       FAX 924446

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

Signature · 5 lines
Christian Reiss <[email protected]>
demonserver.de

Key fingerprint = 2999 B7CD A218 06DF D658  5BE3 18B6 B232 02FF 71B2
Public Key can be obtained here: http://www.demonlord.de/pgp.txt
#5 lore raw
Quoted 6 lines · Christian Reiss

Greetings again,

Curious, I replied, but did not recive a copy of my reply, maybe it got lost in the internet? :) Killed by a rogue lvm, I assume ;) - If this was/is only me missing my reply, then I am deeply sorry for spamming - not intentionally, really.

Christian,

as long as you agree that it wasn't LVM it is no problem ;-)

Quoted 10 lines

---

Hi there!

Big thanks for the very fast answer!!
Much appreciated!

Just to be VERY sure, tune2fs -l says:

<SNIP>

Quoted 1 line

Block count: 250576896

<SNIP>

Quoted 1 line

Block size: 4096

<SNIP>

Quoted 3 lines

So What lvreduce size should i use to shrink it? I better have a guru look over it, better safe than sorry

250576896 * 4KB / 1024MB/KB= 978816MB (which is a multiple of 32MB)

->

# lvreduce -L 978816M /dev/share/data

That should free 112640MB or 3520 PEs in your VG.

BTW: you should either run e2fsadm to grow/shrink the unmounted
filesystem _and_ the logical volume in one go
-or-
use the filesystem resizer and lvextend/lvreduce in the correct order (lvextend + grow fs -or- shrink fs + lvreduce).

Problem with the later is getting the size arguments right ;-)

Regards,
Heinz -- The LVM Guy --

Quoted 124 lines

-Christian.

Quoted 6 lines · Heinz Mauelshagen

Christian,

the size of your filesystem and logical volume differs already. That's why e2fsadm fails.
Did you eventually run resize2fs in order to shrink the filesystem ?

Quoted 6 lines

Your logical volume size is 1091456MB (32MB/PE * 34108 PE) but your filesystem size is 963584GB (941GB * 1024MB/GB; check with "tune2fs -l" and look for the block count and block size to calculate this correctly).

In case the result shows, that your filesystem is already smaller

than the LV,

Quoted 88 lines

lvreduce the logical volume appropriately.

Use the block count * block size result and round it up to the next PE!

Regards,
Heinz -- The LVM Guy --

Quoted 76 lines · Christian Reiss

Greetings!

I am trying to dissolve a running LVM, so i am doing the e2fsadm, lvreduce, pvmove thingy. But ever since I removed the first hdd, I am unable to resize the lvm any more. The error can be seen below, with e2fsadm. I also included the vg&lvdisplay commands.

I am running the LVM1 sources (non-cvs, approx mid last year), as i am unable to run LVM2 (need to downgrade kernel to 2.4.22 (no patch included in lvm2 for 2.4.23)). Also, I am (too dumb/unable) to locate a e2fsadm alike tool for lvm2, as e2fsadm needs the lvm-tab thingy, which lvm2 no longer provides.

Any help is greatly appreciated.

-Christian.

::::::::::::::::::
::: vgdisplay ::::

--- Volume group ---

VG Name               share
VG Access             read/write
VG Status             available/NOT resizable
VG #                  0
MAX LV                256
Cur LV                1
Open LV               1
MAX LV Size           2 TB
Max PV                256
Cur PV                11
Act PV                11
VG Size               1.12 TB
PE Size               32 MB
Total PE              36668
Alloc PE / Size       34108 / 1.04 TB
Free  PE / Size       2560 / 80 GB
VG UUID               PSYbaQ-bl8d-xvHp-6re2-hoKd-9mE5-Wa5Tqz

:::::::::::::::
:: lvdisplay ::

--- Logical volume ---

LV Name                /dev/share/data
VG Name                share
LV Write Access        read/write
LV Status              available
LV #                   1
# open                 1
LV Size                1.04 TB
Current LE             34108
Allocated LE           34108
Allocation             next free
Read ahead sectors     1024
Block device           58:0

:::::::::::::
:: e2fsadm ::

e2fsadm -L-10G /dev/share/data
e2fsadm -- logical volume size for "/dev/share/data" invalid

:::::::::::
:: df -h ::

Filesystem            Size  Used Avail Use% Mounted on
/dev/share/data       941G  910G   32G  97% /share/filebase

--
Christian Reiss <[email protected]>
demonserver.de

Quoted 9 lines
Quoted 2 lines

Key fingerprint = 2999 B7CD A218 06DF D658 5BE3 18B6 B232 02FF 71B2 Public Key can be obtained here: http://www.demonlord.de/pgp.txt

*** Software bugs are stupid.
Nevertheless it needs not so stupid people to solve them ***

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Quoted 8 lines

Heinz Mauelshagen Red Hat, Inc.
Consulting Development Engineer Am Sonnenhang 11
56242 Marienrachdorf Germany
[email protected] +49 2626 141200

                                                       FAX 924446
Quoted 15 lines

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Quoted 6 lines

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

Signature · 5 lines
Christian Reiss <[email protected]>
demonserver.de

Key fingerprint = 2999 B7CD A218 06DF D658  5BE3 18B6 B232 02FF 71B2
Public Key can be obtained here: http://www.demonlord.de/pgp.txt

*** Software bugs are stupid.
Nevertheless it needs not so stupid people to solve them ***

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Heinz Mauelshagen Red Hat, Inc.
Consulting Development Engineer Am Sonnenhang 11
56242 Marienrachdorf Germany
[email protected] +49 2626 141200

                                                       FAX 924446

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

#6 lore raw

Greetings again,

Yes, of course it was not a rogue lvm ;)
Fun is a must, eh?

Anyway,
Here is my recipe of shrinking the lvm.
I hope i got it right, now with the e2fsadm thingy:

1. unmount it
2. e2fsadm -L-(SIZE)G /dev/share/data
3. pvmove /dev/(HDD)
4. vgchange -a n ; vgchange -x y
5. vgreduce share /dev/(HDD)
6. vgchange -x n ; vgchange -a y
7. fdisk /dev/(HDD)
8. mkfs.ext2 auf /dev/(HDD)
9. Copy files to reduce data amount on LVM
10. repeat

Or am i missing anything? :)
If not, i will spent some hours of GREAT FUN
shrinking it. Ahh, the fsck's, movings and.. :)

-Christian.
BTW: Awesome support! :)

Quoted 228 lines · Heinz Mauelshagen
Quoted 6 lines · Christian Reiss

Greetings again,

Curious, I replied, but did not recive a copy of my reply, maybe it got lost in the internet? :) Killed by a rogue lvm, I assume ;) - If this was/is only me missing my reply, then I am deeply sorry for spamming - not intentionally, really.

Christian,

as long as you agree that it wasn't LVM it is no problem ;-)

Quoted 9 lines

---

Hi there!

Big thanks for the very fast answer!!
Much appreciated!

Just to be VERY sure, tune2fs -l says:

<SNIP>

Quoted 1 line

Block count: 250576896

<SNIP>

Quoted 1 line

Block size: 4096

<SNIP>

Quoted 3 lines

So What lvreduce size should i use to shrink it? I better have a guru look over it, better safe than sorry

250576896 * 4KB / 1024MB/KB= 978816MB (which is a multiple of 32MB)

->

# lvreduce -L 978816M /dev/share/data

That should free 112640MB or 3520 PEs in your VG.

BTW: you should either run e2fsadm to grow/shrink the unmounted
filesystem _and_ the logical volume in one go
-or-
use the filesystem resizer and lvextend/lvreduce in the correct order (lvextend + grow fs -or- shrink fs + lvreduce).

Problem with the later is getting the size arguments right ;-)

Regards,
Heinz -- The LVM Guy --

Quoted 129 lines

-Christian.

Quoted 6 lines · Heinz Mauelshagen

Christian,

the size of your filesystem and logical volume differs already. That's why e2fsadm fails.
Did you eventually run resize2fs in order to shrink the filesystem ?

Quoted 6 lines

Your logical volume size is 1091456MB (32MB/PE * 34108 PE) but your filesystem size is 963584GB (941GB * 1024MB/GB; check with "tune2fs -l" and look for the block count and block size to calculate this correctly).

In case the result shows, that your filesystem is already smaller

than the LV,

Quoted 89 lines

lvreduce the logical volume appropriately.

Use the block count * block size result and round it up to the next PE!

Regards,
Heinz -- The LVM Guy --

Quoted 76 lines · Christian Reiss

Greetings!

I am trying to dissolve a running LVM, so i am doing the e2fsadm, lvreduce, pvmove thingy. But ever since I removed the first hdd, I am unable to resize the lvm any more. The error can be seen below, with e2fsadm. I also included the vg&lvdisplay commands.

I am running the LVM1 sources (non-cvs, approx mid last year), as i am unable to run LVM2 (need to downgrade kernel to 2.4.22 (no patch included in lvm2 for 2.4.23)). Also, I am (too dumb/unable) to locate a e2fsadm alike tool for lvm2, as e2fsadm needs the lvm-tab thingy, which lvm2 no longer provides.

Any help is greatly appreciated.

-Christian.

::::::::::::::::::
::: vgdisplay ::::

--- Volume group ---

VG Name               share
VG Access             read/write
VG Status             available/NOT resizable
VG #                  0
MAX LV                256
Cur LV                1
Open LV               1
MAX LV Size           2 TB
Max PV                256
Cur PV                11
Act PV                11
VG Size               1.12 TB
PE Size               32 MB
Total PE              36668
Alloc PE / Size       34108 / 1.04 TB
Free  PE / Size       2560 / 80 GB
VG UUID               PSYbaQ-bl8d-xvHp-6re2-hoKd-9mE5-Wa5Tqz

:::::::::::::::
:: lvdisplay ::

--- Logical volume ---

LV Name                /dev/share/data
VG Name                share
LV Write Access        read/write
LV Status              available
LV #                   1
# open                 1
LV Size                1.04 TB
Current LE             34108
Allocated LE           34108
Allocation             next free
Read ahead sectors     1024
Block device           58:0

:::::::::::::
:: e2fsadm ::

e2fsadm -L-10G /dev/share/data
e2fsadm -- logical volume size for "/dev/share/data" invalid

:::::::::::
:: df -h ::

Filesystem            Size  Used Avail Use% Mounted on
/dev/share/data       941G  910G   32G  97% /share/filebase

--
Christian Reiss <[email protected]>
demonserver.de

Quoted 9 lines
Quoted 2 lines

Key fingerprint = 2999 B7CD A218 06DF D658 5BE3 18B6 B232 02FF 71B2 Public Key can be obtained here: http://www.demonlord.de/pgp.txt

*** Software bugs are stupid.
Nevertheless it needs not so stupid people to solve them ***

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Quoted 7 lines

Heinz Mauelshagen Red Hat, Inc.
Consulting Development Engineer Am Sonnenhang 11
56242 Marienrachdorf Germany
[email protected] +49 2626 141200

                                                      FAX 924446
Quoted 15 lines

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Quoted 5 lines

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

Signature · 5 lines
Christian Reiss <[email protected]>
demonserver.de

Key fingerprint = 2999 B7CD A218 06DF D658  5BE3 18B6 B232 02FF 71B2
Public Key can be obtained here: http://www.demonlord.de/pgp.txt

*** Software bugs are stupid.
Nevertheless it needs not so stupid people to solve them ***

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Heinz Mauelshagen Red Hat, Inc.
Consulting Development Engineer Am Sonnenhang 11
56242 Marienrachdorf Germany
[email protected] +49 2626 141200

                                                       FAX 924446

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

Signature · 5 lines
Christian Reiss <[email protected]>
demonserver.de

Key fingerprint = 2999 B7CD A218 06DF D658  5BE3 18B6 B232 02FF 71B2
Public Key can be obtained here: http://www.demonlord.de/pgp.txt
#9 lore raw
In reply to Heinz Mauelshagen
Quoted 9 lines · Heinz Mauelshagen

the size of your filesystem and logical volume differs already. That's why e2fsadm fails.
Did you eventually run resize2fs in order to shrink the filesystem ?

Your logical volume size is 1091456MB (32MB/PE * 34108 PE) but your filesystem size is 963584GB (941GB * 1024MB/GB; check with "tune2fs -l" and look for the block count and block size to calculate this correctly).

Quoted 4 lines

In case the result shows, that your filesystem is already smaller than the LV, lvreduce the logical volume appropriately.

Use the block count * block size result and round it up to the next PE!

To avoid an error in calculating the correct number of logical extents, and possibly doing an lvreduce(8) to a size smaller than the filesystem:

Use resize_ext2(8) without a size argument. This will resize the ext2 or ext3 filesystem to be the same size as the logical volume containing it. After doing this, e2fsadm(8) can be used to resize the filesystem and logical volume "simultaneously" to any desired size (that can contain the filesystem's data).

Sincerely,

Ken Fuchs <[email protected]>

#8 lore raw
In reply to Heinz Mauelshagen

Heinz Mauelshagen wrote:
...

Quoted 7 lines

BTW: you should either run e2fsadm to grow/shrink the unmounted
filesystem _and_ the logical volume in one go
-or-
use the filesystem resizer and lvextend/lvreduce in the correct order (lvextend + grow fs -or- shrink fs + lvreduce).

Problem with the later is getting the size arguments right ;-)

Be overly conservative and just grow the filesystem to fill the leftover space afterwards. So overguess on shrinking the filesystem, choose something safe for the lv shrink, then grow the filesystem to fill.

#7 lore raw
In reply to Christian Reiss
Quoted 4 lines · Christian Reiss

Greetings again,

Yes, of course it was not a rogue lvm ;)
Fun is a must, eh?

:)

Quoted 4 lines

Anyway,
Here is my recipe of shrinking the lvm.
I hope i got it right, now with the e2fsadm thingy:

If you want to shrink a VG in order to reduce it by PVs, there's no need to deactivate the VG (see below).

Regards,
Heinz -- The LVM Guy --

Quoted 4 lines

1. unmount it
2. e2fsadm -L-(SIZE)G /dev/share/data
3. pvmove /dev/(HDD)

Not needed > 4. vgchange -a n

4. vgchange -x y

Quoted 1 line

5. vgreduce share /dev/(HDD)

Not needed > 6. vgchange -a y

6. vgchange -x n

Quoted 200 lines

7. fdisk /dev/(HDD)
8. mkfs.ext2 auf /dev/(HDD)
9. Copy files to reduce data amount on LVM
10. repeat

Or am i missing anything? :)
If not, i will spent some hours of GREAT FUN
shrinking it. Ahh, the fsck's, movings and.. :)

-Christian.
BTW: Awesome support! :)

Quoted 184 lines · Heinz Mauelshagen
Quoted 6 lines · Christian Reiss

Greetings again,

Curious, I replied, but did not recive a copy of my reply, maybe it got lost in the internet? :) Killed by a rogue lvm, I assume ;) - If this was/is only me missing my reply, then I am deeply sorry for spamming - not intentionally, really.

Christian,

as long as you agree that it wasn't LVM it is no problem ;-)

Quoted 9 lines

---

Hi there!

Big thanks for the very fast answer!!
Much appreciated!

Just to be VERY sure, tune2fs -l says:

<SNIP>

Quoted 1 line

Block count: 250576896

<SNIP>

Quoted 1 line

Block size: 4096

<SNIP>

Quoted 3 lines

So What lvreduce size should i use to shrink it? I better have a guru look over it, better safe than sorry

250576896 * 4KB / 1024MB/KB= 978816MB (which is a multiple of 32MB)

->

# lvreduce -L 978816M /dev/share/data

That should free 112640MB or 3520 PEs in your VG.

BTW: you should either run e2fsadm to grow/shrink the unmounted
filesystem _and_ the logical volume in one go
-or-
use the filesystem resizer and lvextend/lvreduce in the correct order (lvextend + grow fs -or- shrink fs + lvreduce).

Problem with the later is getting the size arguments right ;-)

Regards,
Heinz -- The LVM Guy --

Quoted 120 lines

-Christian.

Quoted 6 lines · Heinz Mauelshagen

Christian,

the size of your filesystem and logical volume differs already. That's why e2fsadm fails.
Did you eventually run resize2fs in order to shrink the filesystem ?

Quoted 6 lines

Your logical volume size is 1091456MB (32MB/PE * 34108 PE) but your filesystem size is 963584GB (941GB * 1024MB/GB; check with "tune2fs -l" and look for the block count and block size to calculate this correctly).

In case the result shows, that your filesystem is already smaller

than the LV,

Quoted 96 lines

lvreduce the logical volume appropriately.

Use the block count * block size result and round it up to the next PE!

Regards,
Heinz -- The LVM Guy --

Quoted 72 lines · Christian Reiss

Greetings!

I am trying to dissolve a running LVM, so i am doing the e2fsadm, lvreduce, pvmove thingy. But ever since I removed the first hdd, I am unable to resize the lvm any more. The error can be seen below, with e2fsadm. I also included the vg&lvdisplay commands.

I am running the LVM1 sources (non-cvs, approx mid last year), as i am unable to run LVM2 (need to downgrade kernel to 2.4.22 (no patch included in lvm2 for 2.4.23)). Also, I am (too dumb/unable) to locate a e2fsadm alike tool for lvm2, as e2fsadm needs the lvm-tab thingy, which lvm2 no longer provides.

Any help is greatly appreciated.

-Christian.

::::::::::::::::::
::: vgdisplay ::::

--- Volume group ---

VG Name               share
VG Access             read/write
VG Status             available/NOT resizable
VG #                  0
MAX LV                256
Cur LV                1
Open LV               1
MAX LV Size           2 TB
Max PV                256
Cur PV                11
Act PV                11
VG Size               1.12 TB
PE Size               32 MB
Total PE              36668
Alloc PE / Size       34108 / 1.04 TB
Free  PE / Size       2560 / 80 GB
VG UUID               PSYbaQ-bl8d-xvHp-6re2-hoKd-9mE5-Wa5Tqz

:::::::::::::::
:: lvdisplay ::

--- Logical volume ---

LV Name                /dev/share/data
VG Name                share
LV Write Access        read/write
LV Status              available
LV #                   1
# open                 1
LV Size                1.04 TB
Current LE             34108
Allocated LE           34108
Allocation             next free
Read ahead sectors     1024
Block device           58:0

:::::::::::::
:: e2fsadm ::

e2fsadm -L-10G /dev/share/data
e2fsadm -- logical volume size for "/dev/share/data" invalid

:::::::::::
:: df -h ::

Filesystem            Size  Used Avail Use% Mounted on
/dev/share/data       941G  910G   32G  97% /share/filebase
Quoted 6 lines

--
Christian Reiss <[email protected]>
demonserver.de

Key fingerprint = 2999 B7CD A218 06DF D658 5BE3 18B6 B232 02FF 71B2 Public Key can be obtained here: http://www.demonlord.de/pgp.txt

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

Signature · 2 lines
Christian Reiss <[email protected]>
demonserver.de
Quoted 15 lines
Quoted 7 lines
Quoted 2 lines

Key fingerprint = 2999 B7CD A218 06DF D658 5BE3 18B6 B232 02FF 71B2 Public Key can be obtained here: http://www.demonlord.de/pgp.txt

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

Signature · 5 lines
Christian Reiss <[email protected]>
demonserver.de

Key fingerprint = 2999 B7CD A218 06DF D658  5BE3 18B6 B232 02FF 71B2
Public Key can be obtained here: http://www.demonlord.de/pgp.txt

*** Software bugs are stupid.
Nevertheless it needs not so stupid people to solve them ***

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Heinz Mauelshagen Red Hat, Inc.
Consulting Development Engineer Am Sonnenhang 11
56242 Marienrachdorf Germany
[email protected] +49 2626 141200

                                                       FAX 924446

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

#10 lore raw
In reply to Ken Fuchs

Ken,

the missing task was to shrink the LV.

Quoted 34 lines · Ken Fuchs
Quoted 9 lines · Heinz Mauelshagen

the size of your filesystem and logical volume differs already. That's why e2fsadm fails.
Did you eventually run resize2fs in order to shrink the filesystem ?

Your logical volume size is 1091456MB (32MB/PE * 34108 PE) but your filesystem size is 963584GB (941GB * 1024MB/GB; check with "tune2fs -l" and look for the block count and block size to calculate this correctly).

Quoted 4 lines

In case the result shows, that your filesystem is already smaller than the LV, lvreduce the logical volume appropriately.

Use the block count * block size result and round it up to the next PE!

To avoid an error in calculating the correct number of logical extents, and possibly doing an lvreduce(8) to a size smaller than the filesystem:

Use resize_ext2(8) without a size argument. This will resize the ext2 or ext3 filesystem to be the same size as the logical volume containing it. After doing this, e2fsadm(8) can be used to resize the filesystem and logical volume "simultaneously" to any desired size (that can contain the filesystem's data).

Sincerely,

Ken Fuchs <[email protected]>

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

Signature · 15 lines
Regards,
Heinz    -- The LVM Guy --

*** Software bugs are stupid.
    Nevertheless it needs not so stupid people to solve them ***

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Heinz Mauelshagen                                 Red Hat, Inc.
Consulting Development Engineer                   Am Sonnenhang 11
                                                  56242 Marienrachdorf
                                                  Germany
[email protected]                            +49 2626 141200
                                                       FAX 924446
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#11 lore raw
Quoted 1 line · Heinz Mauelshagen

the missing task was to shrink the LV.

Yes, I know. The following does that (indirectly):

# resize_ext2 /<LV path>

Without the size argument this command resizes the ext2 or ext3 filesystem to fit the LV (obviating the need to calculate a new size of the LV that fits the filesystem size which may not even be optimal if the filesystem size is not a multiple of the extent size).

# e2fsadm --size <desired size> /<LV path>

or

# e2fsadm --extents <desired size in extents> /<LV path>

Used to resize the LV and ext2 or ext3 filesystem in a single step.

The whole point of the above two step sequence is to avoid the possibility of miscalculating the new size of the LV when using lvreduce(8). It is a safer, though longer way to effectively do a lvreduce(8) or lvextent(8) when the contained filesystem is ext2 or ext3.

In my opinion, this is a better solution when one is uncertain about the correct size to use with lvreduce(8) to shrink the LV to fit either an ext2 or ext3 filesystem.

The previous message is quoted below.

Sincerely,

Ken Fuchs <[email protected]>

Quoted 60 lines · Ken Fuchs
Quoted 34 lines
Quoted 9 lines · Heinz Mauelshagen

the size of your filesystem and logical volume differs already. That's why e2fsadm fails.
Did you eventually run resize2fs in order to shrink the filesystem ?

Your logical volume size is 1091456MB (32MB/PE * 34108 PE) but your filesystem size is 963584GB (941GB * 1024MB/GB; check with "tune2fs -l" and look for the block count and block size to calculate this correctly).

Quoted 4 lines

In case the result shows, that your filesystem is already smaller than the LV, lvreduce the logical volume appropriately.

Use the block count * block size result and round it up to the next PE!

To avoid an error in calculating the correct number of logical extents, and possibly doing an lvreduce(8) to a size smaller than the filesystem:

Use resize_ext2(8) without a size argument. This will resize the ext2 or ext3 filesystem to be the same size as the logical volume containing it. After doing this, e2fsadm(8) can be used to resize the filesystem and logical volume "simultaneously" to any desired size (that can contain the filesystem's data).

Sincerely,

Ken Fuchs <[email protected]>

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

Signature · 21 lines
Regards,
Heinz    -- The LVM Guy --

*** Software bugs are stupid.
   Nevertheless it needs not so stupid people to solve them ***

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Heinz Mauelshagen                                 Red Hat, Inc.
Consulting Development Engineer                   Am Sonnenhang 11
                                                 56242 Marienrachdorf
                                                 Germany
[email protected]                            +49 2626 141200
                                                      FAX 924446
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
#12 lore raw
Quoted 7 lines · Ken Fuchs
Quoted 1 line · Heinz Mauelshagen

the missing task was to shrink the LV.

Yes, I know. The following does that (indirectly):

# resize_ext2 /<LV path>

That would grow the FS back to the LV size, not shrink it down to the FS size which is the intention in this particular case.

Quoted 12 lines

Without the size argument this command resizes the ext2 or ext3 filesystem to fit the LV (obviating the need to calculate a new size of the LV that fits the filesystem size which may not even be optimal if the filesystem size is not a multiple of the extent size).

# e2fsadm --size <desired size> /<LV path>

or

# e2fsadm --extents <desired size in extents> /<LV path>
Quoted 7 lines

Used to resize the LV and ext2 or ext3 filesystem in a single step.

The whole point of the above two step sequence is to avoid the possibility of miscalculating the new size of the LV when using lvreduce(8). It is a safer, though longer way to effectively do a lvreduce(8) or lvextent(8) when the contained filesystem is ext2 or ext3.

I know. I wrote it ;)

The FS was smaller than the LV already due to some unknown problem.

Quoted 4 lines

In my opinion, this is a better solution when one is uncertain about the correct size to use with lvreduce(8) to shrink the LV to fit either an ext2 or ext3 filesystem.

Absolutely users should prefer using e2fsadm doing LV + ext2/ext3 resizing (presumably they can, because the FS and LV have the same size).

Regards,
Heinz -- The LVM Guy --

Quoted 69 lines

The previous message is quoted below.

Sincerely,

Ken Fuchs <[email protected]>

Quoted 28 lines · Ken Fuchs
Quoted 27 lines
Quoted 9 lines · Heinz Mauelshagen

the size of your filesystem and logical volume differs already. That's why e2fsadm fails.
Did you eventually run resize2fs in order to shrink the filesystem ?

Your logical volume size is 1091456MB (32MB/PE * 34108 PE) but your filesystem size is 963584GB (941GB * 1024MB/GB; check with "tune2fs -l" and look for the block count and block size to calculate this correctly).

Quoted 4 lines

In case the result shows, that your filesystem is already smaller than the LV, lvreduce the logical volume appropriately.

Use the block count * block size result and round it up to the next PE!

To avoid an error in calculating the correct number of logical extents, and possibly doing an lvreduce(8) to a size smaller than the filesystem:

Use resize_ext2(8) without a size argument. This will resize the ext2 or ext3 filesystem to be the same size as the logical volume containing it. After doing this, e2fsadm(8) can be used to resize the filesystem and logical volume "simultaneously" to any desired size (that can contain the filesystem's data).

Sincerely,

Quoted 32 lines
Quoted 7 lines

Ken Fuchs <[email protected]>

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

Signature · 21 lines
Regards,
Heinz    -- The LVM Guy --

*** Software bugs are stupid.
   Nevertheless it needs not so stupid people to solve them ***

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Heinz Mauelshagen                                 Red Hat, Inc.
Consulting Development Engineer                   Am Sonnenhang 11
                                                 56242 Marienrachdorf
                                                 Germany
[email protected]                            +49 2626 141200
                                                      FAX 924446
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
Quoted 5 lines

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

*** Software bugs are stupid.
Nevertheless it needs not so stupid people to solve them ***

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Heinz Mauelshagen Red Hat, Inc.
Consulting Development Engineer Am Sonnenhang 11
56242 Marienrachdorf Germany
[email protected] +49 2626 141200

                                                       FAX 924446

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

#13 lore raw
Quoted 9 lines
Quoted 3 lines
Quoted 1 line · Heinz Mauelshagen

the missing task was to shrink the LV.

Quoted 3 lines · Ken Fuchs

Yes, I know. The following does that (indirectly):

# resize_ext2 /<LV path>

Sorry, I didn't make it clear that the above command is only the first of a two command sequence. The second command of the sequence as posted earlier and quoted further down in this message was:

# e2fsadm --extents <desired size in extents> /<LV path>
Quoted 2 lines · Heinz Mauelshagen

That would grow the FS back to the LV size, not shrink it down to the FS size which is the intention in this particular case.

Actually, as I recall (also implied by quoted text at the end of this message), the person who started this thread wanted to use e2fsadm(8) to resize a ext2/ext3 filesystem/logical volume, but e2fsadm failed complaining that the filesystem was smaller than the logical volume. There are at least three potential solutions to this problem:

1) Grow the ext2/ext3 filesystem to fit the logical volume using resize_ext2(8). The default FS size for resize_ext2 is the containing block device size, making this a safe and easy solution.

   # resize_ext2 /<LV path>

2) Shrink the LV to fit the current ext2/ext3 filesystem size, but lvreduce(8) has no awareness of the containing filesystem (if any) and thus can't have an option to reduce the logical volume to the fit the containing filesystem.

   # lvreduce --extents `<command that computes size in extents>` /<LV path>

3) Modify e2fsadm(8), so rather than failing when the ext2/ext3 filesystem is initially smaller than the containing LV, it issues a warning and optionally asks whether or not to proceed. This or a similar solution is probably the best.

Shrinking the LV size down to the _exact_ size of the FS may not even be possible if the filesystem size is not an even multiple of the extent size of the containing VG. Thus, growing the (ext2 or ext3) filesystem to fit the current LV size using resize_ext2(8) may be a better preliminary step to using e2fsadm(8), since an ext2/ext3 filesystem has a finer granularity than LVM.

The entire previous message is quoted below.

Sincerely,

Ken Fuchs <[email protected]>

------------------------------------------------------------------------

Quoted 141 lines · Ken Fuchs
Quoted 7 lines
Quoted 1 line · Heinz Mauelshagen

the missing task was to shrink the LV.

Yes, I know. The following does that (indirectly):

# resize_ext2 /<LV path>

That would grow the FS back to the LV size, not shrink it down to the FS size which is the intention in this particular case.

Quoted 12 lines

Without the size argument this command resizes the ext2 or ext3 filesystem to fit the LV (obviating the need to calculate a new size of the LV that fits the filesystem size which may not even be optimal if the filesystem size is not a multiple of the extent size).

# e2fsadm --size <desired size> /<LV path>

or

# e2fsadm --extents <desired size in extents> /<LV path>
Quoted 7 lines

Used to resize the LV and ext2 or ext3 filesystem in a single step.

The whole point of the above two step sequence is to avoid the possibility of miscalculating the new size of the LV when using lvreduce(8). It is a safer, though longer way to effectively do a lvreduce(8) or lvextent(8) when the contained filesystem is ext2 or ext3.

I know. I wrote it ;)

The FS was smaller than the LV already due to some unknown problem.

Quoted 4 lines

In my opinion, this is a better solution when one is uncertain about the correct size to use with lvreduce(8) to shrink the LV to fit either an ext2 or ext3 filesystem.

Absolutely users should prefer using e2fsadm doing LV + ext2/ext3 resizing (presumably they can, because the FS and LV have the same size).

Regards,
Heinz -- The LVM Guy --

Quoted 69 lines

The previous message is quoted below.

Sincerely,

Ken Fuchs <[email protected]>

Quoted 28 lines · Ken Fuchs
Quoted 27 lines
Quoted 9 lines · Heinz Mauelshagen

the size of your filesystem and logical volume differs already. That's why e2fsadm fails.
Did you eventually run resize2fs in order to shrink the filesystem ?

Your logical volume size is 1091456MB (32MB/PE * 34108 PE) but your filesystem size is 963584GB (941GB * 1024MB/GB; check with "tune2fs -l" and look for the block count and block size to calculate this correctly).

Quoted 4 lines

In case the result shows, that your filesystem is already smaller than the LV, lvreduce the logical volume appropriately.

Use the block count * block size result and round it up to the next PE!

To avoid an error in calculating the correct number of logical extents, and possibly doing an lvreduce(8) to a size smaller than the filesystem:

Use resize_ext2(8) without a size argument. This will resize the ext2 or ext3 filesystem to be the same size as the logical volume containing it. After doing this, e2fsadm(8) can be used to resize the filesystem and logical volume "simultaneously" to any desired size (that can contain the filesystem's data).

Sincerely,

Quoted 32 lines
Quoted 7 lines

Ken Fuchs <[email protected]>

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

Signature · 21 lines
Regards,
Heinz    -- The LVM Guy --

*** Software bugs are stupid.
   Nevertheless it needs not so stupid people to solve them ***

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Heinz Mauelshagen                                 Red Hat, Inc.
Consulting Development Engineer                   Am Sonnenhang 11
                                                 56242 Marienrachdorf
                                                 Germany
[email protected]                            +49 2626 141200
                                                      FAX 924446
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
Quoted 5 lines

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

*** Software bugs are stupid.
Nevertheless it needs not so stupid people to solve them ***

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Heinz Mauelshagen Red Hat, Inc.
Consulting Development Engineer Am Sonnenhang 11
56242 Marienrachdorf Germany
[email protected] +49 2626 141200

                                                      FAX 924446

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/