LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-07-2020, 11:28 AM   #1
ddenial
Member
 
Registered: Dec 2016
Distribution: CentOS, Fedora, Ubuntu
Posts: 359

Rep: Reputation: 56
Reduce size of disk...


Hello All

I want to reduce the disk size of the system which has LVM of partitions. This is KVM VM in a lab environment.

This was before:
Code:
# df -h  
Filesystem              Size  Used Avail Use% Mounted on  
devtmpfs                474M     0  474M   0% /dev 
tmpfs                   491M     0  491M   0% /dev/shm 
tmpfs                   491M  6.7M  484M   2% /run 
tmpfs                   491M     0  491M   0% /sys/fs/cgroup 
/dev/mapper/vgcnt-root   27G  3.0G   24G  12% / 
/dev/vda1               976M  118M  791M  13% /boot 
tmpfs                    99M  4.0K   99M   1% /run/user/0 

# lvs 
  LV   VG    Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert 
  root vgcnt -wi-ao---- <26.83g                    
  swap vgcnt -wi-ao----  <2.17g 
I reduced the size of the root LVM partition to 8GB. I did that by first making a dump of xfs root partition, removing the root partition, creating a new smaller root partition, and finally restoring dump to the newly created root partition.

The new filesystem is like this now
Code:
# df -h
Filesystem              Size  Used Avail Use% Mounted on
devtmpfs                474M     0  474M   0% /dev 
tmpfs                   491M     0  491M   0% /dev/shm
tmpfs                   491M  6.7M  484M   2% /run 
tmpfs                   491M     0  491M   0% /sys/fs/cgroup
/dev/mapper/vgcnt-root  8.0G  2.9G  5.2G  37% /
/dev/vda1               976M  118M  791M  13% /boot
tmpfs                    99M  4.0K   99M   1% /run/user/0 

# lvs
  LV   VG    Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root vgcnt -wi-ao----  8.00g
  swap vgcnt -wi-ao---- <2.17g 


# vgs
  VG    #PV #LV #SN Attr   VSize   VFree  
  vgcnt   1   2   0 wz--n- <29.00g <18.83g

# pvs
  PV         VG    Fmt  Attr PSize   PFree  
  /dev/vda2  vgcnt lvm2 a--  <29.00g <18.83g

# fdisk -l /dev/vda
Disk /dev/vda: 30 GiB, 32212254720 bytes, 62914560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x741ab813

Device     Boot   Start      End  Sectors Size Id Type
/dev/vda1  *       2048  2099199  2097152   1G 83 Linux
/dev/vda2       2099200 62914559 60815360  29G 8e Linux LVM
Now, I want to remove that free 18gb in volume group and physical volume and reduce the total disk size from 30G to 12G.

How do I proceed next? First, reduce the physical volume and then reduce the volume group? Or, first, reduce volume group and then go to physical volume?

And what about reducing the total disk size to 12G?

I'm confused? I appreciate any guidance.

Thanks
 
Old 06-07-2020, 11:56 AM   #2
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,706

Rep: Reputation: Disabled
Reducing volume group means taking a physical volume out of it. I don't think you can shrink a VG without resizing PV first.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Reduce swap disk size chrisguk Linux - Newbie 9 03-29-2019 04:47 PM
[SOLVED] how to resize/ shrink disk size the KVM disk size in proxmox? arsyam Linux - Server 1 01-06-2018 05:45 AM
How to reduce linux disk size before virtualizing it? ppmoore Linux - Newbie 5 03-21-2017 01:21 AM
any ideas to reduce log file size or make log file size managed? George2 Programming 2 08-13-2006 06:55 AM
Knoppix Hdd installation -I want to reduce the size on Disk!! rayesteq Linux - General 2 09-13-2004 05:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration