LVM: Decrease/shrink size of a physical volume by deallocating free space from removed logical volume
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I have the following LVM partition:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/data-root 5.3G 4.2G 864M 84% /
...
/dev/mapper/data-install 6.8G 5.7G 783M 89% /install
# vgs
VG #PV #LV #SN Attr VSize VFree
data 1 2 0 wz--n- <12.50g 0
# vgdisplay
--- Volume group ---
VG Name data
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size <12.50 GiB
PE Size 4.00 MiB
Total PE 3199
Alloc PE / Size 3199 / <12.50 GiB
Free PE / Size 0 / 0
VG UUID jSACsC-wGwy-ki0w-nSCn-kxMy-bLOV-dVN68E
# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 data lvm2 a-- <12.50g 0
# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name data
PV Size <12.50 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 3199
Free PE 0
Allocated PE 3199
PV UUID CPggVR-sUXw-4gfw-lb2v-cq0j-M5ey-Ct7td3
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
install data -wi-ao---- 7.00g
root data -wi-ao---- <5.50g
# lvdisplay
--- Logical volume ---
LV Path /dev/data/install
LV Name install
VG Name data
LV UUID ZXQmp5-L17b-eQyS-g3An-msk7-Jqso-MTaTIw
LV Write Access read/write
LV Creation host, time localhost, 2018-09-28 14:42:43 +0000
LV Status available
open 1
LV Size 7.00 GiB
Current LE 1792
Segments 1
Allocation inherit
Read ahead sectors aut
- currently set to 8192
Block device 253:1
--- Logical volume ---
LV Path /dev/data/root
LV Name root
VG Name data
LV UUID i3eMbC-rcm1-H2Gm-JJeF-jRxO-nL9h-toHSHQ
LV Write Access read/write
LV Creation host, time localhost, 2018-09-28 14:42:55 +0000
LV Status available
# open 1
LV Size <5.50 GiB
Current LE 1407
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
I am removing one of the logical volumes:
# umount /install
# lvremove /dev/data/install
# sed -i 'N;//dev/mapper/data-install/s#/dev/mapper/data-install.*n##' /etc/fstab
After the removal:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/data-root 5.3G 4.2G 867M 84% /
...
# vgs
VG #PV #LV #SN Attr VSize VFre
data 1 1 0 wz--n- <12.50g 7.00g
# vgdisplay
--- Volume group ---
VG Name data
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size <12.50 GiB
PE Size 4.00 MiB
Total PE 3199
Alloc PE / Size 1407 / <5.50 GiB
Free PE / Size 1792 / 7.00 GiB
VG UUID jSACsC-wGwy-ki0w-nSCn-kxMy-bLOV-dVN68E
# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 data lvm2 a-- <12.50g 7.00g
# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name data
PV Size <12.50 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 3199
Free PE 1792
Allocated PE 1407
PV UUID CPggVR-sUXw-4gfw-lb2v-cq0j-M5ey-Ct7td3
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root data -wi-ao---- <5.50g
# lvdisplay
--- Logical volume ---
LV Path /dev/data/root
LV Name root
VG Name data
LV UUID i3eMbC-rcm1-H2Gm-JJeF-jRxO-nL9h-toHSHQ
LV Write Access read/write
LV Creation host, time localhost, 2018-09-28 14:42:55 +0000
LV Status available
# open 1
LV Size <5.50 GiB
Current LE 1407
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
How can I shrink the physical volume, volume group and finally the partition altogether by what amounts to the free space after removing the logical volume? Preferably that should be done specifying relative values (to pvresize
?) or something similar to lvextend -l 100%FREE <lvolume>
. Also I would like to accomplish this using the command line alone (no GUI). It is also worth noting that the root/system logical volume is active and in use at all times.
lvm
New contributor
add a comment |Â
up vote
0
down vote
favorite
I have the following LVM partition:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/data-root 5.3G 4.2G 864M 84% /
...
/dev/mapper/data-install 6.8G 5.7G 783M 89% /install
# vgs
VG #PV #LV #SN Attr VSize VFree
data 1 2 0 wz--n- <12.50g 0
# vgdisplay
--- Volume group ---
VG Name data
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size <12.50 GiB
PE Size 4.00 MiB
Total PE 3199
Alloc PE / Size 3199 / <12.50 GiB
Free PE / Size 0 / 0
VG UUID jSACsC-wGwy-ki0w-nSCn-kxMy-bLOV-dVN68E
# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 data lvm2 a-- <12.50g 0
# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name data
PV Size <12.50 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 3199
Free PE 0
Allocated PE 3199
PV UUID CPggVR-sUXw-4gfw-lb2v-cq0j-M5ey-Ct7td3
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
install data -wi-ao---- 7.00g
root data -wi-ao---- <5.50g
# lvdisplay
--- Logical volume ---
LV Path /dev/data/install
LV Name install
VG Name data
LV UUID ZXQmp5-L17b-eQyS-g3An-msk7-Jqso-MTaTIw
LV Write Access read/write
LV Creation host, time localhost, 2018-09-28 14:42:43 +0000
LV Status available
open 1
LV Size 7.00 GiB
Current LE 1792
Segments 1
Allocation inherit
Read ahead sectors aut
- currently set to 8192
Block device 253:1
--- Logical volume ---
LV Path /dev/data/root
LV Name root
VG Name data
LV UUID i3eMbC-rcm1-H2Gm-JJeF-jRxO-nL9h-toHSHQ
LV Write Access read/write
LV Creation host, time localhost, 2018-09-28 14:42:55 +0000
LV Status available
# open 1
LV Size <5.50 GiB
Current LE 1407
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
I am removing one of the logical volumes:
# umount /install
# lvremove /dev/data/install
# sed -i 'N;//dev/mapper/data-install/s#/dev/mapper/data-install.*n##' /etc/fstab
After the removal:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/data-root 5.3G 4.2G 867M 84% /
...
# vgs
VG #PV #LV #SN Attr VSize VFre
data 1 1 0 wz--n- <12.50g 7.00g
# vgdisplay
--- Volume group ---
VG Name data
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size <12.50 GiB
PE Size 4.00 MiB
Total PE 3199
Alloc PE / Size 1407 / <5.50 GiB
Free PE / Size 1792 / 7.00 GiB
VG UUID jSACsC-wGwy-ki0w-nSCn-kxMy-bLOV-dVN68E
# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 data lvm2 a-- <12.50g 7.00g
# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name data
PV Size <12.50 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 3199
Free PE 1792
Allocated PE 1407
PV UUID CPggVR-sUXw-4gfw-lb2v-cq0j-M5ey-Ct7td3
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root data -wi-ao---- <5.50g
# lvdisplay
--- Logical volume ---
LV Path /dev/data/root
LV Name root
VG Name data
LV UUID i3eMbC-rcm1-H2Gm-JJeF-jRxO-nL9h-toHSHQ
LV Write Access read/write
LV Creation host, time localhost, 2018-09-28 14:42:55 +0000
LV Status available
# open 1
LV Size <5.50 GiB
Current LE 1407
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
How can I shrink the physical volume, volume group and finally the partition altogether by what amounts to the free space after removing the logical volume? Preferably that should be done specifying relative values (to pvresize
?) or something similar to lvextend -l 100%FREE <lvolume>
. Also I would like to accomplish this using the command line alone (no GUI). It is also worth noting that the root/system logical volume is active and in use at all times.
lvm
New contributor
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have the following LVM partition:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/data-root 5.3G 4.2G 864M 84% /
...
/dev/mapper/data-install 6.8G 5.7G 783M 89% /install
# vgs
VG #PV #LV #SN Attr VSize VFree
data 1 2 0 wz--n- <12.50g 0
# vgdisplay
--- Volume group ---
VG Name data
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size <12.50 GiB
PE Size 4.00 MiB
Total PE 3199
Alloc PE / Size 3199 / <12.50 GiB
Free PE / Size 0 / 0
VG UUID jSACsC-wGwy-ki0w-nSCn-kxMy-bLOV-dVN68E
# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 data lvm2 a-- <12.50g 0
# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name data
PV Size <12.50 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 3199
Free PE 0
Allocated PE 3199
PV UUID CPggVR-sUXw-4gfw-lb2v-cq0j-M5ey-Ct7td3
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
install data -wi-ao---- 7.00g
root data -wi-ao---- <5.50g
# lvdisplay
--- Logical volume ---
LV Path /dev/data/install
LV Name install
VG Name data
LV UUID ZXQmp5-L17b-eQyS-g3An-msk7-Jqso-MTaTIw
LV Write Access read/write
LV Creation host, time localhost, 2018-09-28 14:42:43 +0000
LV Status available
open 1
LV Size 7.00 GiB
Current LE 1792
Segments 1
Allocation inherit
Read ahead sectors aut
- currently set to 8192
Block device 253:1
--- Logical volume ---
LV Path /dev/data/root
LV Name root
VG Name data
LV UUID i3eMbC-rcm1-H2Gm-JJeF-jRxO-nL9h-toHSHQ
LV Write Access read/write
LV Creation host, time localhost, 2018-09-28 14:42:55 +0000
LV Status available
# open 1
LV Size <5.50 GiB
Current LE 1407
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
I am removing one of the logical volumes:
# umount /install
# lvremove /dev/data/install
# sed -i 'N;//dev/mapper/data-install/s#/dev/mapper/data-install.*n##' /etc/fstab
After the removal:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/data-root 5.3G 4.2G 867M 84% /
...
# vgs
VG #PV #LV #SN Attr VSize VFre
data 1 1 0 wz--n- <12.50g 7.00g
# vgdisplay
--- Volume group ---
VG Name data
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size <12.50 GiB
PE Size 4.00 MiB
Total PE 3199
Alloc PE / Size 1407 / <5.50 GiB
Free PE / Size 1792 / 7.00 GiB
VG UUID jSACsC-wGwy-ki0w-nSCn-kxMy-bLOV-dVN68E
# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 data lvm2 a-- <12.50g 7.00g
# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name data
PV Size <12.50 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 3199
Free PE 1792
Allocated PE 1407
PV UUID CPggVR-sUXw-4gfw-lb2v-cq0j-M5ey-Ct7td3
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root data -wi-ao---- <5.50g
# lvdisplay
--- Logical volume ---
LV Path /dev/data/root
LV Name root
VG Name data
LV UUID i3eMbC-rcm1-H2Gm-JJeF-jRxO-nL9h-toHSHQ
LV Write Access read/write
LV Creation host, time localhost, 2018-09-28 14:42:55 +0000
LV Status available
# open 1
LV Size <5.50 GiB
Current LE 1407
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
How can I shrink the physical volume, volume group and finally the partition altogether by what amounts to the free space after removing the logical volume? Preferably that should be done specifying relative values (to pvresize
?) or something similar to lvextend -l 100%FREE <lvolume>
. Also I would like to accomplish this using the command line alone (no GUI). It is also worth noting that the root/system logical volume is active and in use at all times.
lvm
New contributor
I have the following LVM partition:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/data-root 5.3G 4.2G 864M 84% /
...
/dev/mapper/data-install 6.8G 5.7G 783M 89% /install
# vgs
VG #PV #LV #SN Attr VSize VFree
data 1 2 0 wz--n- <12.50g 0
# vgdisplay
--- Volume group ---
VG Name data
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size <12.50 GiB
PE Size 4.00 MiB
Total PE 3199
Alloc PE / Size 3199 / <12.50 GiB
Free PE / Size 0 / 0
VG UUID jSACsC-wGwy-ki0w-nSCn-kxMy-bLOV-dVN68E
# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 data lvm2 a-- <12.50g 0
# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name data
PV Size <12.50 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 3199
Free PE 0
Allocated PE 3199
PV UUID CPggVR-sUXw-4gfw-lb2v-cq0j-M5ey-Ct7td3
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
install data -wi-ao---- 7.00g
root data -wi-ao---- <5.50g
# lvdisplay
--- Logical volume ---
LV Path /dev/data/install
LV Name install
VG Name data
LV UUID ZXQmp5-L17b-eQyS-g3An-msk7-Jqso-MTaTIw
LV Write Access read/write
LV Creation host, time localhost, 2018-09-28 14:42:43 +0000
LV Status available
open 1
LV Size 7.00 GiB
Current LE 1792
Segments 1
Allocation inherit
Read ahead sectors aut
- currently set to 8192
Block device 253:1
--- Logical volume ---
LV Path /dev/data/root
LV Name root
VG Name data
LV UUID i3eMbC-rcm1-H2Gm-JJeF-jRxO-nL9h-toHSHQ
LV Write Access read/write
LV Creation host, time localhost, 2018-09-28 14:42:55 +0000
LV Status available
# open 1
LV Size <5.50 GiB
Current LE 1407
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
I am removing one of the logical volumes:
# umount /install
# lvremove /dev/data/install
# sed -i 'N;//dev/mapper/data-install/s#/dev/mapper/data-install.*n##' /etc/fstab
After the removal:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/data-root 5.3G 4.2G 867M 84% /
...
# vgs
VG #PV #LV #SN Attr VSize VFre
data 1 1 0 wz--n- <12.50g 7.00g
# vgdisplay
--- Volume group ---
VG Name data
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size <12.50 GiB
PE Size 4.00 MiB
Total PE 3199
Alloc PE / Size 1407 / <5.50 GiB
Free PE / Size 1792 / 7.00 GiB
VG UUID jSACsC-wGwy-ki0w-nSCn-kxMy-bLOV-dVN68E
# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 data lvm2 a-- <12.50g 7.00g
# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name data
PV Size <12.50 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 3199
Free PE 1792
Allocated PE 1407
PV UUID CPggVR-sUXw-4gfw-lb2v-cq0j-M5ey-Ct7td3
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root data -wi-ao---- <5.50g
# lvdisplay
--- Logical volume ---
LV Path /dev/data/root
LV Name root
VG Name data
LV UUID i3eMbC-rcm1-H2Gm-JJeF-jRxO-nL9h-toHSHQ
LV Write Access read/write
LV Creation host, time localhost, 2018-09-28 14:42:55 +0000
LV Status available
# open 1
LV Size <5.50 GiB
Current LE 1407
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
How can I shrink the physical volume, volume group and finally the partition altogether by what amounts to the free space after removing the logical volume? Preferably that should be done specifying relative values (to pvresize
?) or something similar to lvextend -l 100%FREE <lvolume>
. Also I would like to accomplish this using the command line alone (no GUI). It is also worth noting that the root/system logical volume is active and in use at all times.
lvm
lvm
New contributor
New contributor
edited Oct 4 at 8:37
New contributor
asked Oct 3 at 22:46
SaveMeTenMinutes
13
13
New contributor
New contributor
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
Well, pvresize
doesn't have an option for relative values like lvextend
does, so you need to specify the exact size you want. Here's what you can do:
- Shrink physical volume:
pvresize --setphysicalvolumesize 5.5G /dev/sda2
- Shrink the partition with the tool of your choice. If you want to script it you can use parted. Make the partition a little bit bigger than 5.5G to account for any differences in how the size in bytes is calculated, or ensure you're using the same unit in both tools.
- If the units differed between the tools, expand the physical volume to consume the entire partition:
pvresize /dev/sda2
# pvresize --setphysicalvolumesize 5.5G /dev/sda2
⤶/dev/sda2: Requested size 5.50 GiB is less than real size <12.50 GiB. Proceed? [y/n]: y
⤶WARNING: /dev/sda2: Pretending size is 11534336 not 26212352 sectors.
⤶/dev/sda2: cannot resize to 1407 extents as later ones are allocated.
⤶0 physical volume(s) resized / 1 physical volume(s) not resized
â SaveMeTenMinutes
Oct 4 at 9:29
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Well, pvresize
doesn't have an option for relative values like lvextend
does, so you need to specify the exact size you want. Here's what you can do:
- Shrink physical volume:
pvresize --setphysicalvolumesize 5.5G /dev/sda2
- Shrink the partition with the tool of your choice. If you want to script it you can use parted. Make the partition a little bit bigger than 5.5G to account for any differences in how the size in bytes is calculated, or ensure you're using the same unit in both tools.
- If the units differed between the tools, expand the physical volume to consume the entire partition:
pvresize /dev/sda2
# pvresize --setphysicalvolumesize 5.5G /dev/sda2
⤶/dev/sda2: Requested size 5.50 GiB is less than real size <12.50 GiB. Proceed? [y/n]: y
⤶WARNING: /dev/sda2: Pretending size is 11534336 not 26212352 sectors.
⤶/dev/sda2: cannot resize to 1407 extents as later ones are allocated.
⤶0 physical volume(s) resized / 1 physical volume(s) not resized
â SaveMeTenMinutes
Oct 4 at 9:29
add a comment |Â
up vote
0
down vote
Well, pvresize
doesn't have an option for relative values like lvextend
does, so you need to specify the exact size you want. Here's what you can do:
- Shrink physical volume:
pvresize --setphysicalvolumesize 5.5G /dev/sda2
- Shrink the partition with the tool of your choice. If you want to script it you can use parted. Make the partition a little bit bigger than 5.5G to account for any differences in how the size in bytes is calculated, or ensure you're using the same unit in both tools.
- If the units differed between the tools, expand the physical volume to consume the entire partition:
pvresize /dev/sda2
# pvresize --setphysicalvolumesize 5.5G /dev/sda2
⤶/dev/sda2: Requested size 5.50 GiB is less than real size <12.50 GiB. Proceed? [y/n]: y
⤶WARNING: /dev/sda2: Pretending size is 11534336 not 26212352 sectors.
⤶/dev/sda2: cannot resize to 1407 extents as later ones are allocated.
⤶0 physical volume(s) resized / 1 physical volume(s) not resized
â SaveMeTenMinutes
Oct 4 at 9:29
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Well, pvresize
doesn't have an option for relative values like lvextend
does, so you need to specify the exact size you want. Here's what you can do:
- Shrink physical volume:
pvresize --setphysicalvolumesize 5.5G /dev/sda2
- Shrink the partition with the tool of your choice. If you want to script it you can use parted. Make the partition a little bit bigger than 5.5G to account for any differences in how the size in bytes is calculated, or ensure you're using the same unit in both tools.
- If the units differed between the tools, expand the physical volume to consume the entire partition:
pvresize /dev/sda2
Well, pvresize
doesn't have an option for relative values like lvextend
does, so you need to specify the exact size you want. Here's what you can do:
- Shrink physical volume:
pvresize --setphysicalvolumesize 5.5G /dev/sda2
- Shrink the partition with the tool of your choice. If you want to script it you can use parted. Make the partition a little bit bigger than 5.5G to account for any differences in how the size in bytes is calculated, or ensure you're using the same unit in both tools.
- If the units differed between the tools, expand the physical volume to consume the entire partition:
pvresize /dev/sda2
answered Oct 4 at 5:17
Emmanuel Rosa
2,6501411
2,6501411
# pvresize --setphysicalvolumesize 5.5G /dev/sda2
⤶/dev/sda2: Requested size 5.50 GiB is less than real size <12.50 GiB. Proceed? [y/n]: y
⤶WARNING: /dev/sda2: Pretending size is 11534336 not 26212352 sectors.
⤶/dev/sda2: cannot resize to 1407 extents as later ones are allocated.
⤶0 physical volume(s) resized / 1 physical volume(s) not resized
â SaveMeTenMinutes
Oct 4 at 9:29
add a comment |Â
# pvresize --setphysicalvolumesize 5.5G /dev/sda2
⤶/dev/sda2: Requested size 5.50 GiB is less than real size <12.50 GiB. Proceed? [y/n]: y
⤶WARNING: /dev/sda2: Pretending size is 11534336 not 26212352 sectors.
⤶/dev/sda2: cannot resize to 1407 extents as later ones are allocated.
⤶0 physical volume(s) resized / 1 physical volume(s) not resized
â SaveMeTenMinutes
Oct 4 at 9:29
# pvresize --setphysicalvolumesize 5.5G /dev/sda2
⤶/dev/sda2: Requested size 5.50 GiB is less than real size <12.50 GiB. Proceed? [y/n]: y
⤶WARNING: /dev/sda2: Pretending size is 11534336 not 26212352 sectors.
⤶/dev/sda2: cannot resize to 1407 extents as later ones are allocated.
⤶0 physical volume(s) resized / 1 physical volume(s) not resized
â SaveMeTenMinutes
Oct 4 at 9:29
# pvresize --setphysicalvolumesize 5.5G /dev/sda2
⤶/dev/sda2: Requested size 5.50 GiB is less than real size <12.50 GiB. Proceed? [y/n]: y
⤶WARNING: /dev/sda2: Pretending size is 11534336 not 26212352 sectors.
⤶/dev/sda2: cannot resize to 1407 extents as later ones are allocated.
⤶0 physical volume(s) resized / 1 physical volume(s) not resized
â SaveMeTenMinutes
Oct 4 at 9:29
add a comment |Â
SaveMeTenMinutes is a new contributor. Be nice, and check out our Code of Conduct.
SaveMeTenMinutes is a new contributor. Be nice, and check out our Code of Conduct.
SaveMeTenMinutes is a new contributor. Be nice, and check out our Code of Conduct.
SaveMeTenMinutes is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f473105%2flvm-decrease-shrink-size-of-a-physical-volume-by-deallocating-free-space-from-r%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password