LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 07-14-2014, 12:20 AM   #1
OutcastShadow
LQ Newbie
 
Registered: Jul 2014
Distribution: Slackware
Posts: 8
Blog Entries: 1

Rep: Reputation: Disabled
Question LVM2 reducing the size of a VG & installing Slackware


After a recent "issue" with installing a functioning gentoo distro I decided to start fresh and reformat my HDD.

I did so while installing the Crunchbang (Debian derivative) distro (Crunchbang 11 Waldorf).

Instead of going with the traditional partitioning scheme I decided to utilize LVM2, as such my scheme (and other info that may be relevant is:

Code:
:~# uname -m
x86_64
:~# uname -p
unknown
~# uname -o
GNU/Linux
~# uname -s
Linux
:~# uname -r
3.2.0-4-amd64
:~# uname -v
#1 SMP Debian 3.2.57-3+deb7u2

  LVM version:     2.02.95(2) (2012-03-06)
  Library version: 1.02.74 (2012-03-06)
  Driver version:  4.22.0

:~# fdisk -l

Disk /dev/sda: 250.1 GB, 250059350016 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          501758   488396799   243947521    5  Extended
/dev/sda5          501760   488396799   243947520   8e  Linux LVM

Disk /dev/mapper/shadows-root: 9999 MB, 9999220736 bytes

Disk /dev/mapper/shadows-swap_1: 3443 MB, 3443523584 bytes

Disk /dev/mapper/shadows-home: 107.4 GB, 107374182400 bytes

(And of course it must be noted, that b/c it's done w/LVM2, for all logical volumes:
Disk /dev/mapper/shadows-allofthem doesn't contain a valid partition table)

:~# pvdisplay

  --- Volume group ---
  VG Name               shadows
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  5
  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               232.64 GiB
  PE Size               4.00 MiB
  Total PE              59557
  Alloc PE / Size       28805 / 112.52 GiB
  Free  PE / Size       30752 / 120.12 GiB
  VG UUID               isawholebunchastuffPV
   
:~# vgdisplay
  --- Volume group ---
  VG Name               shadows
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  5
  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               232.64 GiB
  PE Size               4.00 MiB
  Total PE              59557
  Alloc PE / Size       28805 / 112.52 GiB
  Free  PE / Size       30752 / 120.12 GiB
  VG UUID               isawholebunchaotherstuffVG
My home partition used to take up the entirety of the remaining space in the volume group but I have managed to figure out how to at least reduce the size of the LV w/o losing data (yay me).

Code:
:~# lvdisplay
  --- Logical volume ---
  LV Path                /dev/shadows/root
  LV Name                root
  VG Name                shadows
  LV UUID                isawholebunchaotherstuffLVR
  LV Write Access        read/write
  LV Creation host, time shadows, 2014-06-14 23:36:08 -0400
  LV Status              available
  # open                 1
  LV Size                9.31 GiB
  Current LE             2384
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0
   
  --- Logical volume ---
  LV Path                /dev/shadows/swap_1
  LV Name                swap_1
  VG Name                shadows
  LV UUID                isawholebunchaotherstuffLVS
  LV Write Access        read/write
  LV Creation host, time shadows, 2014-06-14 23:36:08 -0400
  LV Status              available
  # open                 2
  LV Size                3.21 GiB
  Current LE             821
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:1
   
  --- Logical volume ---
  LV Path                /dev/shadows/home
  LV Name                home
  VG Name                shadows
  LV UUID                isawholebunchaotherstuffLVH
  LV Write Access        read/write
  LV Creation host, time shadows, 2014-06-14 23:36:08 -0400
  LV Status              available
  # open                 1
  LV Size                100.00 GiB
  Current LE             25600
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:2
Now I'm wanting to install Slackware as my second distro.

In order to do this in the most logical fashion that I can fathom, I plan to
  1. reduce the size of my current "shadows" volume group
  2. create a new VG "slack" (or something of that nature) of size 50GiB
  3. create LV "slackroot" (10GiB)
  4. create LV "slackhome" (40GiB)
  5. skip creating a swap partition and instead share ownership of the one currently utilized by #!
  6. continue on with a Slackware install.
I don't plan on utilizing LILO, but instead plan on continuing to utilize GrUB (2, not legacy) as it seems to be the bootloader that will be the supported standard going forward.

I have been googling, searching forums, reading man pages and info pages for over a week or so now but to no avail. I am stuck at the step where I reduce the size of my volume group.

I'd like to do this properly without having to reformat my HDD (again).

Maybe I'm just missing the information and it's been right in front of my eyes. Maybe I'm just not up to snuff on my skills yet.

Can anyone point me in the best direction to keep my little project going?

I'm totally willing to screw up and end up reformatting the HDD again. I'd just prefer to not do that. If this weren't my personal machine that I'm using for learning purposes doing that could be a real mess.

Thanks for taking the time to review my problem. I tried to make sure that I included all of the information that could be necessary. If I missed anything I'll be glad to gather the info and post it ASAP.

Any assistance would be greatly appreciated.
 
Old 07-14-2014, 08:22 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,987

Rep: Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217
Let's start at the beginning - you have read the manpage for LVM; and thence proceeded to vgreduce ? The description for the latter is very specific. Also tldp.org has an old but still relevant how-to/guide for LVM.
LVM is predicated on pv's - having only one, you don't have the luxury to remove one.

As it is a learning experience, why not use that free space in the vg for the slack lv(s) ?.
Note that you can (now) reduce the size of the pv and add another partition to the disk, then you can proceed as you planned. I haven't tried that.
 
Old 07-14-2014, 09:32 PM   #3
OutcastShadow
LQ Newbie
 
Registered: Jul 2014
Distribution: Slackware
Posts: 8
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by syg00 View Post
Let's start at the beginning - you have read the manpage for LVM; and thence proceeded to vgreduce ? The description for the latter is very specific. Also tldp.org has an old but still relevant how-to/guide for LVM.
LVM is predicated on pv's - having only one, you don't have the luxury to remove one.

As it is a learning experience, why not use that free space in the vg for the slack lv(s) ?.
Note that you can (now) reduce the size of the pv and add another partition to the disk, then you can proceed as you planned. I haven't tried that.
RE manpages: Affirmative. I have read the manpage for LVM. I then proceeded to the manpage for vgreduce (as well as the manpages for the other LVM2 commands). I have made notes (physical pen & paper notes) regarding each of them.

RE tldp.org: Affirmative. My non-work time has been devoted to 2 things and two things only: Keeping my wife entertained and reading up on this particular aspect of Gnu/Linux. Sadly the former consumes more time than the latter and is rarely greeted with the same sense of accomplishment upon partial task completion.

RE multi-pv's: Yeah. Figured that part out. Wish I'd known that when I jumped the gun and leapt head first into LVM upon #! re-installation. LOL

RE freespace for slack: It just seemed to make better sense to have it set up in another VG. It is not inconceivable that I was mistaken.

RE reduce size of pv: In one of the documents I've been perusing I thought that I had read that reducing the size of the PV would then reduce the size of the VG. I was unsure as to where I'd read it though; I lost it somewhere in the volume of data I've been consuming. While you state that you haven't tried it yet, it seems that the way to proceed from there would be to then increase again the size of the PV, create a new VG under that, and proceed. Does that sound correct?
 
Old 07-14-2014, 11:31 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,987

Rep: Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217
No, looking at the manpage, pvresize will only attempt to use already freed space - and won't re-org things. There's an example in the manpage - note you have to shrink the real partition yourself - as well as create the new one.
Shrink everything, create a new partition, make it a pv, create a vg for Slack, and off you go.

Maybe. If you do it a step at a time shouldn't break your current setup. If it does, start again. Either way you learn something.
 
Old 07-15-2014, 03:15 AM   #5
OutcastShadow
LQ Newbie
 
Registered: Jul 2014
Distribution: Slackware
Posts: 8
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
Indeed it did not break my current setup when I went in and utilized
Code:
pvresize --setphysicalvolumesize -115G /dev/sda5
The vg reduced in size correspondingly.
When I tried to "size up" the pv again though the vg automatically sized back up as well.
I thought that maybe it would help if I restarted the machine after sizing the pv down. It did not. When I sized the pv up again, the vg resized right along with it.

Rather than create another pv on the same physical device (I only have one hard drive), I decided to just run with the idea of implementing a couple of new lv's.
Code:
  --- Logical volume ---
  LV Path                /dev/shadows/slackroot
  LV Name                slackroot
  VG Name                shadows
  LV UUID                XXX
  LV Write Access        read/write
  LV Creation host, time slackware, 2014-07-13 23:28:45 -0400
  LV Status              available
  # open                 0
  LV Size                10.00 GiB
  Current LE             2560
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:3
   
  --- Logical volume ---
  LV Path                /dev/shadows/slackhome
  LV Name                slackhome
  VG Name                shadows
  LV UUID                XXXX
  LV Write Access        read/write
  LV Creation host, time slackware, 2014-07-13 23:29:05 -0400
  LV Status              available
  # open                 0
  LV Size                50.00 GiB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:4
Then I went ahead with my Slackware installation.

That is how I broke my #! install.

So I've reinstalled #! (it's what I'm comfortable with as of now) and, since I was frustrated with my previous failures of the evening I went ahead and let LILO install onto the superblock in /dev/shadows/slackroot. I was wise enough (I believe) to create a boot usb that should allow me, according to the installer, to simply insert the usb stick and then get slackware booted up. I plan on setting up my GRUB to handle it or possibly chain load LILO. I'm not really 100% sure right now but I'm also having trouble propping my eyelids open as I type, so it's probably best I pick it up again tomorrow.
 
Old 07-16-2014, 03:01 AM   #6
OutcastShadow
LQ Newbie
 
Registered: Jul 2014
Distribution: Slackware
Posts: 8
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
I'm going to close this off now. I managed to tinker around with the whole thing and nearly achieved success. I kept ending up with a kernel panic though while utilizing LVM and installing Slackware (even after wiping the entire HDD and starting from scratch with a fresh LVM partitioning scheme).

In the interests of maintaining the status quo with regards to domestic bliss I decided to simply revert to a more traditional partitioning scheme utilizing extended partitions and forgoing the immediate utilization of GrUB, sticking with a "traditional" LILO install and letting the Slackware installer do the heavy lifting.

I am now at least operating off of a system that has a working copy of Slackware instead of a Debian based system.

For some reason this has granted me a sense of accomplishment (deserved or not).
 
  


Reply

Tags
linux, lvm2, slackware 14.1


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
Reducing size in LVM SBN Linux - General 8 07-28-2009 07:30 AM
Installing Slackware with lvm2 cwwilson721 Slackware 3 05-14-2006 12:48 AM
Reducing Debian Installation Size??? kushalkoolwal Debian 18 08-15-2005 02:58 PM
Reducing file size using mencoder SithX Linux - Software 3 04-15-2005 09:56 PM
Reducing kernel size Kholnuu Slackware 6 01-22-2005 03:57 AM

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

All times are GMT -5. The time now is 06:05 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration