LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 10-08-2005, 07:00 PM   #1
Arkanoid
LQ Newbie
 
Registered: Mar 2005
Location: Copenhagen, Denmark
Distribution: Gentoo 2005.1, Slackware 10.1
Posts: 12

Rep: Reputation: 0
Resizing partition with LogVol


I have a partition (/dev/hda3) that contains a LVM. In this, there is a partition (/) that I want to resize. The free space shall then be used to create a few partitions for a Gentoo-system.
However, I have no idea whatsoever, about how to do this... can it be done through parted? (Resizing a part of LVM, that is)
The editing will be done from an Ubuntu LiveCD to keep the drive unmounted.
 
Old 10-08-2005, 08:53 PM   #2
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,995
Blog Entries: 5

Rep: Reputation: 782Reputation: 782Reputation: 782Reputation: 782Reputation: 782Reputation: 782Reputation: 782
Haven't used lvm on Linux but it has same commands as lvm on HP-UX so I'm assuming it is similar.

Do "man lvm" for details. This will lead you to other lvm related man pages.

From what you wrote it sounds as if you want to shrink "/" to free up some space. The command for shrinking a logical volume would be "lvreduce" but you need to carefully read the man page (man lvreduce) for that before trying it. If it says it is safe to do then it probably is but it is something that I've not done. Since this is "/" screwing it up would cause your system not to boot at all.
 
Old 10-09-2005, 05:32 AM   #3
Arkanoid
LQ Newbie
 
Registered: Mar 2005
Location: Copenhagen, Denmark
Distribution: Gentoo 2005.1, Slackware 10.1
Posts: 12

Original Poster
Rep: Reputation: 0
Ok, thanks for the info, I got a little further now.
I used the lvreduce command, to reduce my lv. It's currently around 40G (was: 78G):

--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID WOrelO-57zy-jzsb-Nc1a-J5Hs-bMs1-IZ4JvQ
LV Write Access read/write
LV Status available
# open 0
LV Size 39,28 GB
Current LE 1257
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 254:2

However, I still can't resize the lvm partition itself. According to fdisk, it's still 78G:

Disk /dev/hda: 122.9 GB, 122942324736 bytes
255 heads, 63 sectors/track, 14946 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 5099 40957686 7 HPFS/NTFS
/dev/hda2 5100 5112 104422+ 83 Linux
/dev/hda3 5113 14946 78991605 8e Linux LVM

So fdisk blocks when I try to make a new partition. This doesn't seem illogical in any way, since it's only the filesystem itself that has been resized.
So the question is, how do I resize the partition (/dev/hda3)? The resize function in parted is also only for filesystems and I couldn't find anything useful in fdisk.

Thanks, in advance
 
Old 10-09-2005, 07:34 AM   #4
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,995
Blog Entries: 5

Rep: Reputation: 782Reputation: 782Reputation: 782Reputation: 782Reputation: 782Reputation: 782Reputation: 782
You're talking apples and oranges:

partitions = Physical slices of the hard drives

volumes = Logical slices of ONE of the partitions

Breaking down LVM some (hopefully you read the LVM man page as suggested):

PV = Physical Volume - This can be a whole disk or a partition thereof. You typically have to initialize a disk or partition with pvcreate. (Linux is different than HP-UX where you have to add whole disks because HP-UX doesn't do partitions.) The pvdisplay command will show you details of any PV that has been initiallized for LVM.


VG = Volume Group - A logical unit containing one or more PVs. You can have multiple VGs (each has to have separate PVs). Running just "vgdisplay" on your system ought to show you the ones you have defined. (The -v flag will show you which PVs are included.)

LV = Logical Volume - A subdivision of a VG. You can have multiple LVs on a VG but each LV must be wholly contained within a single VG - that is you can't create an LV that is comprised of parts of two different VGs. Running lvdisplay on the LVs seen from vgdisplay above will show you details of the LVs.

Conceptually VG is like a logical disk and LV is like a logical partition.

Your question then is how to reduce the physical partition rather than the logical volume which I hadn't really noticed before. The command fdisk is the primary partition utility. I've seen a lot of mention of the command parted so it may work better for you but I haven't used it.

CAUTION: I believe (but won't swear) that changing your partition size would necessitate destroying the contents of the partition so you would have to recreate it.

Read the man pages for fdisk and/or parted BEFORE you do anything to see exactly what they'll do. I'd strongly urge you to do a backup of everything before you continue.

There are multiple commands for LVM - just do ls -l /sbin/vg* /sbin/lv* /sbin/pv* to see a list of most of them. You should be able to do "man <command>" on any command you see there.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Resizing Linux Partition From Partition magic John_Emad Suse/Novell 5 02-16-2005 12:42 PM
need help resizing an ext3 partition with an underlying partition... spiroth10 Linux - Software 1 07-30-2004 12:21 PM
Resizing my partition. Saitoku Linux - Newbie 2 06-02-2004 06:08 PM
Resizing a partition aikempshall Linux - Hardware 4 04-22-2004 03:06 AM
Resizing the / partition lacerto Linux - General 1 03-18-2004 12:48 PM


All times are GMT -5. The time now is 04:31 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration