Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Gentoo Hardened using OpenRC not Systemd
Posts: 1,495
Rep:
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.
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.
Distribution: Gentoo Hardened using OpenRC not Systemd
Posts: 1,495
Original Poster
Rep:
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)
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.