PDA

View Full Version : SLES 12 SP1 Resize partition and VM provisioned space



pasiit
02-Nov-2016, 16:06
I have SLES 12SP1 running as a virtual machine in an ESXi 5.5 with this current partitions and volumes setup:

$> lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sda 8:0 0 500G 0 disk
├─sda1 8:1 0 45G 0 part [SWAP]
├─sda2 8:2 0 2G 0 part /boot
├─sda3 8:3 0 405G 0 part
│ ├─1W16-dev 254:0 0 14G 0 lvm /udev
│ ├─1W16-home_lv 254:1 0 5G 0 lvm /home
│ ├─1W16-kdump_lv 254:2 0 16G 0 lvm /var/kump
│ ├─1W16-opt 254:3 0 30G 0 lvm /opt
│ ├─1W16-pasilog 254:4 0 55G 0 lvm /pasi/logs
│ ├─1W16-pasireport 254:5 0 12G 0 lvm /pasi/report
│ ├─1W16-tmp 254:6 0 10G 0 lvm /tmp
│ ├─1W16-usr 254:7 0 10G 0 lvm /usr/local
│ └─1W16-var 254:8 0 5.2G 0 lvm /var
└─sda4 8:4 0 48G 0 part /
sr0 11:0 1 1024M 0 rom



$> vgs
VG #PV #LV #SN Attr VSize VFree
1W16 1 9 0 wz--n- 405.00g 247.80g



$> lvdisplay
--- Logical volume ---
LV Path /dev/1W16/dev
LV Name dev
VG Name 1W16
LV UUID ysJPsk-UAIg-Fo2V-R5NH-7BXN-1Kj1-AeKbmo
LV Write Access read/write
LV Creation host, time (none), 2016-02-19 20:04:12 -0500
LV Status available
# open 1
LV Size 14.00 GiB
Current LE 3584
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 1024
Block device 254:0

--- Logical volume ---
LV Path /dev/1W16/home_lv
LV Name home_lv
VG Name 1W16
LV UUID Al6xt2-1fFO-NvpS-barF-rDzD-fN4T-ZdERIw
LV Write Access read/write
LV Creation host, time (none), 2016-02-19 20:04:12 -0500
LV Status available
# open 1
LV Size 5.00 GiB
Current LE 1280
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 1024
Block device 254:1

--- Logical volume ---
LV Path /dev/1W16/kdump_lv
LV Name kdump_lv
VG Name 1W16
LV UUID 83DsjP-qVwE-0DUa-kYW3-JCOI-7LOq-tdXI90
LV Write Access read/write
LV Creation host, time (none), 2016-02-19 20:04:12 -0500
LV Status available
# open 1
LV Size 16.00 GiB
Current LE 4096
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 1024
Block device 254:2

--- Logical volume ---
LV Path /dev/1W16/opt
LV Name opt
VG Name 1W16
LV UUID kCrXrM-nmFi-cQUe-1lME-6Dtm-ryeL-KKwloI
LV Write Access read/write
LV Creation host, time (none), 2016-02-19 20:04:12 -0500
LV Status available
# open 1
LV Size 30.00 GiB
Current LE 7680
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 1024
Block device 254:3

--- Logical volume ---
LV Path /dev/1W16/pasilog
LV Name pasilog
VG Name 1W16
LV UUID oYR40M-cSuP-ZZTM-7ds6-Jbjn-cbcc-gEQrj8
LV Write Access read/write
LV Creation host, time (none), 2016-02-19 20:04:12 -0500
LV Status available
# open 1
LV Size 55.00 GiB
Current LE 14080
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 1024
Block device 254:4

--- Logical volume ---
LV Path /dev/1W16/pasireport
LV Name pasireport
VG Name 1W16
LV UUID XX57wi-YjgE-kW5B-SBwF-tTYX-Odjy-FbZzeV
LV Write Access read/write
LV Creation host, time (none), 2016-02-19 20:04:12 -0500
LV Status available
# open 1
LV Size 12.00 GiB
Current LE 3072
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 1024
Block device 254:5

--- Logical volume ---
LV Path /dev/1W16/tmp
LV Name tmp
VG Name 1W16
LV UUID C1Dg4K-oi7x-ofw1-L7gD-0OZ0-DjlK-X2TAnB
LV Write Access read/write
LV Creation host, time (none), 2016-02-19 20:04:12 -0500
LV Status available
# open 1
LV Size 10.00 GiB
Current LE 2560
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 1024
Block device 254:6

--- Logical volume ---
LV Path /dev/1W16/usr
LV Name usr
VG Name 1W16
LV UUID vP79sC-vHAa-FHxa-BGLp-5QqX-8FsB-BEpKHd
LV Write Access read/write
LV Creation host, time (none), 2016-02-19 20:04:12 -0500
LV Status available
# open 1
LV Size 10.00 GiB
Current LE 2560
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 1024
Block device 254:7

--- Logical volume ---
LV Path /dev/1W16/var
LV Name var
VG Name 1W16
LV UUID JBtd3V-wQuW-mhem-PPZD-XFYT-hTpb-xTS1mu
LV Write Access read/write
LV Creation host, time (none), 2016-02-19 20:04:12 -0500
LV Status available
# open 1
LV Size 5.20 GiB
Current LE 1330
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 1024
Block device 254:8


The sda3 is having 247.80g of unused space and I would like to return this space to the datastore of the ESXi host.
Base on my understanding, I would have to:
1) Reduce the size of the sda3
2) Then somehow reduce the size of the sda
3) Then resize the provisioned space to this VM
I don'y know how to do 1 and 2.
Could someone please help?

Thank you,176

Automatic Reply
07-Nov-2016, 06:30
pasiit,

It appears that in the past few days you have not received a response to your
posting. That concerns us, and has triggered this automated reply.

These forums are peer-to-peer, best effort, volunteer run and that if your issue
is urgent or not getting a response, you might try one of the following options:

- Visit http://www.suse.com/support and search the knowledgebase and/or check all
the other support options available.
- Open a service request: https://www.suse.com/support
- You could also try posting your message again. Make sure it is posted in the
correct newsgroup. (http://forums.suse.com)

Be sure to read the forum FAQ about what to expect in the way of responses:
http://forums.suse.com/faq.php

If this is a reply to a duplicate posting or otherwise posted in error, please
ignore and accept our apologies and rest assured we will issue a stern reprimand
to our posting bot..

Good luck!

Your SUSE Forums Team
http://forums.suse.com

isgleas
18-Nov-2016, 18:49
Hi pasiit,

Bad news is, that your partitioning has an sda4 partition, which goes after the sda3. You would be able to shrink the sda3 partition, but the resulting gap in-between would not be available to be returned to your pool. This sda4 hosts your partition, making the move a little more complicated.

The easiest and safest way would be to rebuild that server (or cloning it)

It can be done however. If you can afford offline time, you could:

Make a new LV, to host your / partition
Fix all your entries in fstab and the bootloader configurations to point to your new /
Test, then remove your sda4 partition


You need to boot from a rescue disk (your installation media would work), as you have then to get your VG offline (vgchange -an 1W16). To reduce the size of the sda3 partition, you have to used your partitioning tools (say, parted), and delete the partition, writing the changes, then creating the partition again setting as the start of the new partition the same block that was before, and the end of it the required blocks to match your needs,

Then, activate the PV, add it to the VG, activate the VG, mount your volumes, fix fstab and bootloader again.

Once done, on your ESX, reduce the disk size (a little bit bigger than required, to make room). Is until then, that you have your extra storage back.

Another way, is to give the VM another disk, with the desired amount of storage (you'll be pivoting), re-create the disk structure on the new disk, copy data, set a new VM with this vdisk and try to boot from it (you may need to repair the bootloader). This method would allow you to remain online, while testing the procedures

Hope this helps,

isgleas
18-Nov-2016, 19:20
Just not to be obvious: you should backup everything before making any change to your storage.