LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 07-29-2006, 04:31 AM   #1
fakie_flip
Senior Member
 
Registered: Feb 2005
Location: san antonio, texas
Distribution: Fedora 64 bit RAID0 + LUKS, CentOS (server), Backtrack, Gentoo Hardened
Posts: 1,440

Rep: Reputation: 80
resizing lvm2 physical volume


I used installed Fedora Core release 5 on my 120gb hard drive. Since I was new to lvm and did not know a whole lot about it, I went with the default install which took up my entire hard drive. I need to reinstall the operating system. I want to backup my pictures and music, but I do not have another hard drive to do it with. how can I resize the lvm thing and create a regular partition to use for backup before I install the Ubuntu. I tried Gnome Partition Editor and that could not even read how much of my lvm partition was being used. I am using lvm2 not lvm.
 
Old 07-29-2006, 12:36 PM   #2
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 1,972

Rep: Reputation: 289Reputation: 289Reputation: 289
You cannot resize a physical volume AFAIK. Volume groups - yes, logical volumes - yes, but not physical volumes. You can add or remove physical volumes from a volume group, but not resize them.

How many physical volumes do you have defined? If it's only one and it takes up your entire harddisk, I don't think you can get to where you want to go directly. If you have multiples, you might be able to use some pvmove/vgreduce commands to get to your destination.

Why don't you run the following commands and post the output here. Maybe there's some way for you to move forward easily if we can see what you have to work with.
Code:
$ su
# fdisk -l
# pvs
# vgs
# lvs
# mount
# df -h
 
Old 08-07-2006, 07:41 AM   #3
fakie_flip
Senior Member
 
Registered: Feb 2005
Location: san antonio, texas
Distribution: Fedora 64 bit RAID0 + LUKS, CentOS (server), Backtrack, Gentoo Hardened
Posts: 1,440

Original Poster
Rep: Reputation: 80
ubuntu@ubuntu:~$ sudo su
root@ubuntu:/home/ubuntu# fdisk -l

Disk /dev/hda: 20.0 GB, 20020396032 bytes
255 heads, 63 sectors/track, 2434 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 1 2434 19551073+ 83 Linux

Disk /dev/hdb: 20.5 GB, 20525137920 bytes
255 heads, 63 sectors/track, 2495 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdb1 1 2495 20041056 83 Linux

Disk /dev/hdc: 123.5 GB, 123522416640 bytes
255 heads, 63 sectors/track, 15017 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdc1 * 1 13 104391 83 Linux
/dev/hdc2 14 15017 120519630 8e Linux LVM
root@ubuntu:/home/ubuntu# pvs
PV VG Fmt Attr PSize PFree
/dev/hdc2 VolGroup00 lvm2 a- 114.91G 32.00M
root@ubuntu:/home/ubuntu# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup00 1 2 0 wz--n- 114.91G 32.00M
root@ubuntu:/home/ubuntu# lvs
LV VG Attr LSize Origin Snap% Move Log Copy%
LogVol00 VolGroup00 -wi-ao 114.38G
LogVol01 VolGroup00 -wi-a- 512.00M
root@ubuntu:/home/ubuntu# mount
unionfs on / type unionfs (rw)
proc on /proc type proc (rw)
/sys on /sys type sysfs (rw)
varrun on /var/run type tmpfs (rw)
varlock on /var/lock type tmpfs (rw)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
devshm on /dev/shm type tmpfs (rw)
lrm on /lib/modules/2.6.15-23-386/volatile type tmpfs (rw)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
/dev/hda1 on /home/ubuntu/Desktop/a type ext3 (rw)
/dev/hdb1 on /home/ubuntu/Desktop/b type ext3 (rw)
/dev/mapper/VolGroup00-LogVol00 on /home/ubuntu/Desktop/v type ext3 (rw)

root@ubuntu:/home/ubuntu# df -h
Filesystem Size Used Avail Use% Mounted on
unionfs 1001M 921M 81M 92% /
varrun 379M 88K 379M 1% /var/run
varlock 379M 4.0K 379M 1% /var/lock
udev 379M 148K 379M 1% /dev
devshm 379M 0 379M 0% /dev/shm
lrm 379M 8.8M 371M 3% /lib/modules/2.6.15-23-386/volatile
tmpfs 379M 24K 379M 1% /tmp
/dev/hda1 19G 17G 1.1G 95% /home/ubuntu/Desktop/a
/dev/hdb1 19G 17G 1.4G 93% /home/ubuntu/Desktop/b
/dev/mapper/VolGroup00-LogVol00
111G 30G 76G 28% /home/ubuntu/Desktop/v

root@ubuntu:/home/ubuntu#

Last edited by fakie_flip; 08-07-2006 at 07:44 AM.
 
Old 08-07-2006, 12:18 PM   #4
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 1,972

Rep: Reputation: 289Reputation: 289Reputation: 289
Based on your posted output I'm afraid I don't see any easy/failsafe path for you. Of course what you want to do can be done in some manner, but every thought that comes to mind comes with big red warning flags "Backup everything first!!!"

But you don't have any harddisk space to backup anything. That's the problem (as you stated initially). I was hoping to to find that Fedora partitioned you disk into multiple PE's, but that did not turn out to be the case. You have one big PE that takes up the vast majority of your disk (a.k.a. /dev/hdc2). You cannot resize a PE and you have no more space on your disk to create any more partitions.

You are using 30Gb of your single large logical volume and there is 76Gb of free space remaining on that volume. Unfortunately you cannot easily make that 76Gb available to use as another normal (non-LVM) partition. Of that 30Gb that you are using, I'd assume about 3-4Gb of that is Fedora, leaving about 27Gb of your personal files. Since you said "pictures and music" I assume you have .jpg and .mp3 files - so you really can't save any space by trying to compress these further.

What to do with 27Gb that needs to be backed up?

(1) You're got 20Gb (total space) on /dev/hda1 and 20Gb more on /dev/hdb1. But both of these are full per your df output listing. I don't know what you have stored on these two smaller disks, but if it's expendable ... there's your backup storage space.

(2) Do you have a DVD burner? 27Gb / 4.5Gb per DVD = 6 or 7 DVD's to backup the whole mess. This will take a couple of hours. A good idea in any case, because you should always have backups external to your main storage (/dev/hdc2). Good DVD burners go for $35 at NewEgg these days. Add 25-50 cents (maybe even less) for each blank DVD you'd need.

(3) Buy another harddisk. 200Gb goes for $50-60 these days (after rebates) if you shop around for sales. I'll guess that you have no place to put in a new internal disk though. You probably have three disks and a CD or DVD drive currently, and that would max out the typical IDE controller connection-wise. You could temporarily replace hda or hdb with a new drive for the backup procedure. An external USB drive is another possibility, but the price goes up steeply compaired to an internal drive.

---

I'm sorry you've gotten into this disk space pickle. LVM is a great tool for managing your diskspace, but once you've turned one disk into one big PE (ignoring your itty-bitty /dev/hdc1 for the moment) then there's not much you can do to reduce that allocation.

What I do when I have no idea how I'll eventually need to allocate a new unpartitioned disk is this:

(1) Create a 5Gb logical partition (all partitions later will be logicals as well)
(2) Leave the rest unpartitioned
(3) Make that 5Gb a PV, and add it to an new VG
(4) Create LV's from this VG as needed for the installation (/home, /var, /usr, /tmp, /opt, etc.)
(5) Format these LV's using a filesystem that is shrinkable (ext3 or reiser = good, xfs or jfs = bad since they can't be shrunk later). If I don't expect to need to shrink (pictures, music - ever growing!) then a non-shrinkable filesystem type would be fine.
(6) When that VG is fully used, partition another 5-10Gb logical partition and make it a new PV
(7) Add the new partition to the VG and continue extending or creating LV's as needed
(8) Repeat as time goes on and I need to grow
(9) If things need to shrink (I've never actually had need to do this) I am positioned to use pvmove and vgreduce to drop some of those PV's from the VG, thus freeing up real diskspace for non-LVM use

You will have to modify the above slightly at the initial steps if you're installing a full OS on the disk. Firstly, you'll need one other "normal" partition outside of LVM to put /boot on. Probably a good idea to put / on non-LVM as well. At least in the old days this was advised, things may have changed so that it's not such a big deal to have / on LVM anymore (original issues had to do come OS upgrade time).

Mine is a very complex setup. Highly flexible, but complex. I don't quite need all this flexibility, but it's a learning vehicle for me as well.
 
  


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
How to find Physical Volumes associated with a Logical Volume Group mghiya Programming 3 09-27-2013 07:59 AM
LVM Physical Volume Lucky_Sevin Linux - Software 2 01-10-2006 10:44 AM
want to convert LVM physical volume to ext3 or vfs nikhil_damu Fedora 2 12-14-2005 11:16 PM
LVM2 volume group not seen after FC4 install digithead1011 Fedora - Installation 6 10-09-2005 09:25 PM
LVM2 on Sarge - HD failure in the volume group container /root Golovko Debian 3 06-20-2005 09:54 PM


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

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