Resize Harddisk

T

tristan

Guest
Hi :),

I need some advise, how to resize harddisk ?

Regards,
Tristan
 
I have completed a Proxmox Host installation.
Code:
# df -l 
dev/mapper/pve-root ... /
tmpfs ... /lib/ini/rw
udev ... /dev
tmpfs ... /dev/shm    
/dev/mapper/pve-data ... /var/lib/vz
/dev/sda1 ... /boot

Code:
#fdisk -l
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          66      524288   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              66       60801   487859712   8e  Linux LVM

Disk /dev/dm-0: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000


Disk /dev/dm-1: 103.0 GB, 103079215104 bytes
255 heads, 63 sectors/track, 12532 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000


Disk /dev/dm-2: 387.9 GB, 387901816832 bytes
255 heads, 63 sectors/track, 47159 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

How can I reduce the size of /dev/sda2 (LVM), so that I can have a 8GB Swap partition on this drive???
 
I never liked easy. So let's do it.
Code:
# [B]lvdisplay[/B]
   --- Logical volume ---
  LV Name                /dev/pve/swap
  VG Name                pve
  LV UUID                fSULxh-H69J-3iu6-6fGv-zyUf-vux4-KUMMp9
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                4.00 GB
  Current LE             1024
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0
   
  --- Logical volume ---
  LV Name                /dev/pve/root
  VG Name                pve
  LV UUID                64Zfbj-BOdy-Icqm-93wW-Hv6V-eChf-c3ROyL
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                96.00 GB
  Current LE             24576
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:1
   
  --- Logical volume ---
  LV Name                /dev/pve/data
  VG Name                pve
  LV UUID                jSTxnG-kpLx-eyac-SWwy-hgoY-Wy9N-lPgf0l
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                361.26 GB
  Current LE             92483
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:2

# [B]vgdisplay[/B]
  --- Volume group ---
  VG Name               pve
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               465.26 GB
  PE Size               4.00 MB
  Total PE              119106
  Alloc PE / Size       118083 / 461.26 GB
  Free  PE / Size       1023 / 4.00 GB
  VG UUID               EPCWMl-xc1n-3xUB-V5TD-YQ1l-6pZY-4NZ464
  
# [B]pvdisplay -m[/B]
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               pve
  PV Size               465.26 GB / not usable 1.50 MB
  Allocatable           yes 
  PE Size (KByte)       4096
  Total PE              119106
  Free PE               1023
  Allocated PE          118083
  PV UUID               JogU1D-cKPA-dQNL-2EwU-YTZT-4kV2-iGkHk6
   
  --- Physical Segments ---
  Physical extent 0 to 1023:
    Logical volume    /dev/pve/swap
    Logical extents    0 to 1023
  Physical extent 1024 to 25599:
    Logical volume    /dev/pve/root
    Logical extents    0 to 24575
  Physical extent 25600 to 118082:
    Logical volume    /dev/pve/data
    Logical extents    0 to 92482
  Physical extent 118083 to 119105:
    FREE
I just want to reduce the LVM to add a Primary/Extended partition that I can use as a 16GB Swap outside of the existing LVM (additional memory for system is on its way).

My reason: I have found that system performance is improved when SWAP is in its own Primary/Logical partition outside of an LVM. and I want to control SWAP sizing outside of the LVM using old Linux tools.
 
Last edited:
I never liked easy. So let's do it.
Code:
# lvdisplay
   --- Logical volume ---
  LV Name                /dev/pve/swap
  VG Name                pve
  LV UUID                fSULxh-H69J-3iu6-6fGv-zyUf-vux4-KUMMp9
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                4.00 GB
  Current LE             1024
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0
   
  --- Logical volume ---
  LV Name                /dev/pve/root
  VG Name                pve
  LV UUID                64Zfbj-BOdy-Icqm-93wW-Hv6V-eChf-c3ROyL
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                96.00 GB
  Current LE             24576
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:1
   
  --- Logical volume ---
  LV Name                /dev/pve/data
  VG Name                pve
  LV UUID                jSTxnG-kpLx-eyac-SWwy-hgoY-Wy9N-lPgf0l
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                361.26 GB
  Current LE             92483
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:2
I just want to reduce the LVM to add a Primary/Extended partition that I can use as a 16GB Swap outside of the existing LVM (additional memory for system is on its way).
vgdisplay
pvdisplay -m

PS:
What the reason to increase swap?
What the reason to use it outsite LVM?
 
@Giner...I have edited the earlier post with the information you requested so that you could see the total configuration in the same windows. Looking forward...and THANKS thus far. I think I can see where this is leading.

I await your directions
 
Last edited:
My reason: I have found that system performance is improved when SWAP is in its own Primary/Logical partition outside of an LVM...

I'm not sure this is really so. As well reducing physical volume will be really harder then logical volumes inside the volume group especially if you don't have additional storage for keeping data temporarily. Moreover, if the system doesn't have enough memory and it tries to use swap - this is already not good strategy i think.
I warned you but anyway I'll try to help you with your "resizings" :)

Show me:
Code:
vgdisplay
pvdisplay -m
 
All of the volume group information is in the earlier post. I edited in for you.
Look in code section
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!