FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora User

 
 
LinkBack Thread Tools
 
Old 08-23-2008, 06:05 AM
Craig White
 
Default lvm resizing and shifting

My hard drive...

# fdisk -l /dev/sda

Disk /dev/sda: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00086350

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 24792 199037317+ 8e Linux LVM

# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 88G 54G 30G 65% /
/dev/sda1 99M 36M 59M 39% /boot

this as a result of resizing/shrinking /dev/VolGroup00/LogVol00 down
from approximately 180 Gb down to 90 Gb (obviously the ext3 filesystem
was resized first because it's working).

I wanted to create free space in the process to do another install not
in the LVM but apparently the swap portion /dev/VolGroup00/LogVol01 is 1
Gb and I'm guessing that it has to be moved to be contiguous
with /dev/VolGroup00/LogVol00 and that should somehow make the allow the
rest of the space to be free to be re-used in other ways.

What piece of information am I missing to make the now approx 90Gb free?

Craig

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 08-23-2008, 07:07 AM
Peter Boy
 
Default lvm resizing and shifting

Am Freitag, den 22.08.2008, 23:05 -0700 schrieb Craig White:
> this as a result of resizing/shrinking /dev/VolGroup00/LogVol00 down
> from approximately 180 Gb down to 90 Gb (obviously the ext3 filesystem
> was resized first because it's working).
>
> I wanted to create free space in the process to do another install not
> in the LVM but apparently the swap portion /dev/VolGroup00/LogVol01 is 1
> Gb and I'm guessing that it has to be moved to be contiguous
> with /dev/VolGroup00/LogVol00 and that should somehow make the allow the
> rest of the space to be free to be re-used in other ways.
>
> What piece of information am I missing to make the now approx 90Gb free?

Not shure if I understand you correctly. You modified the *logical*
volumes. This process does not modify the LVM and the physical partition
on the disk (sda1). Now there is space in the LVM to create just another
logical volume, but that is not what you want.

If you wish to create an additional non-LVM you have to create
a /dev/sda2 which in turn requires to modify (shrink) the /dev/sda1
partition where the LVM is located. I don't know if there are tools
available to do that in a safe manner. You may check man pvresize

Regarding swap you may disable swap in fstab and simply delete the lv.
When you are finished you may recreate and enable it.


Peter



--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 08-23-2008, 03:07 PM
Craig White
 
Default lvm resizing and shifting

On Sat, 2008-08-23 at 09:07 +0200, Peter Boy wrote:
> Am Freitag, den 22.08.2008, 23:05 -0700 schrieb Craig White:
> > this as a result of resizing/shrinking /dev/VolGroup00/LogVol00 down
> > from approximately 180 Gb down to 90 Gb (obviously the ext3 filesystem
> > was resized first because it's working).
> >
> > I wanted to create free space in the process to do another install not
> > in the LVM but apparently the swap portion /dev/VolGroup00/LogVol01 is 1
> > Gb and I'm guessing that it has to be moved to be contiguous
> > with /dev/VolGroup00/LogVol00 and that should somehow make the allow the
> > rest of the space to be free to be re-used in other ways.
> >
> > What piece of information am I missing to make the now approx 90Gb free?
>
> Not shure if I understand you correctly. You modified the *logical*
> volumes. This process does not modify the LVM and the physical partition
> on the disk (sda1). Now there is space in the LVM to create just another
> logical volume, but that is not what you want.
>
> If you wish to create an additional non-LVM you have to create
> a /dev/sda2 which in turn requires to modify (shrink) the /dev/sda1
> partition where the LVM is located. I don't know if there are tools
> available to do that in a safe manner. You may check man pvresize
>
> Regarding swap you may disable swap in fstab and simply delete the lv.
> When you are finished you may recreate and enable it.
----
ah...pvresize

I have to shrink the physical volume too - light bulb finally on,
thanks.

I'm downloading gpartd live CD because I think this should make it
easy...will report back.

Thanks

Craig

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 08-23-2008, 05:13 PM
Craig White
 
Default lvm resizing and shifting

On Sat, 2008-08-23 at 08:07 -0700, Craig White wrote:
> On Sat, 2008-08-23 at 09:07 +0200, Peter Boy wrote:
> > Am Freitag, den 22.08.2008, 23:05 -0700 schrieb Craig White:
> > > this as a result of resizing/shrinking /dev/VolGroup00/LogVol00 down
> > > from approximately 180 Gb down to 90 Gb (obviously the ext3 filesystem
> > > was resized first because it's working).
> > >
> > > I wanted to create free space in the process to do another install not
> > > in the LVM but apparently the swap portion /dev/VolGroup00/LogVol01 is 1
> > > Gb and I'm guessing that it has to be moved to be contiguous
> > > with /dev/VolGroup00/LogVol00 and that should somehow make the allow the
> > > rest of the space to be free to be re-used in other ways.
> > >
> > > What piece of information am I missing to make the now approx 90Gb free?
> >
> > Not shure if I understand you correctly. You modified the *logical*
> > volumes. This process does not modify the LVM and the physical partition
> > on the disk (sda1). Now there is space in the LVM to create just another
> > logical volume, but that is not what you want.
> >
> > If you wish to create an additional non-LVM you have to create
> > a /dev/sda2 which in turn requires to modify (shrink) the /dev/sda1
> > partition where the LVM is located. I don't know if there are tools
> > available to do that in a safe manner. You may check man pvresize
> >
> > Regarding swap you may disable swap in fstab and simply delete the lv.
> > When you are finished you may recreate and enable it.
> ----
> ah...pvresize
>
> I have to shrink the physical volume too - light bulb finally on,
> thanks.
>
> I'm downloading gpartd live CD because I think this should make it
> easy...will report back.
----
I'm kind of stuck...

I was able to reduce the size of the logical volumes, move the logical
volumes so they are adjacent and then reduce the size of the physical
LVM but I cannot seem to reduce the partition itself and I'm gathering
that this may not be possible.

# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup00
PV Size 95.00 GB / not usable 31.81 MB
Allocatable yes
PE Size (KByte) 32768
Total PE 3039
Free PE 127
Allocated PE 2912
PV UUID oAYcCQ-5n28-0C6i-1LLE-voCR-E19v-SQYQK0

# fdisk -l /dev/sda

Disk /dev/sda: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00086350

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 24792 199037317+ 8e Linux LVM

# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 88G 54G 30G 65% /
/dev/sda1 99M 36M 59M 39% /boot

so in the end, /dev/sda2 remains approximately 200G and even the
gpartd-liveCD cannot resize /dev/sda2 ;-(

Is it even possible?

Craig

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 08-23-2008, 06:09 PM
Roberto Ragusa
 
Default lvm resizing and shifting

Craig White wrote:

I was able to reduce the size of the logical volumes, move the logical
volumes so they are adjacent and then reduce the size of the physical
LVM but I cannot seem to reduce the partition itself and I'm gathering
that this may not be possible.

# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup00
PV Size 95.00 GB / not usable 31.81 MB
Allocatable yes
PE Size (KByte) 32768
Total PE 3039
Free PE 127
Allocated PE 2912
PV UUID oAYcCQ-5n28-0C6i-1LLE-voCR-E19v-SQYQK0

# fdisk -l /dev/sda

Disk /dev/sda: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00086350

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 24792 199037317+ 8e Linux LVM

# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 88G 54G 30G 65% /
/dev/sda1 99M 36M 59M 39% /boot

so in the end, /dev/sda2 remains approximately 200G and even the
gpartd-liveCD cannot resize /dev/sda2 ;-(

Is it even possible?


What you are attempting is not a common way to use the LVM system.
I often create many pv on one disk (sda2, sda3, sda4) just to avoid
this kind of problems.

The pv is now 95G, so only the first 95G of sda2 are used (usable).
Now, thinking about it, resizing sda2 could simply mean you
have to delete and immediately recreate sda2 with a smaller size.
We just have to be sure about where the pv metadata are stored.
According to

http://www.guug.de/lokal/rhein-main/2004-09-23/LVM2_sage_23.09.pdf

we learn that

LVM2 format is an ASCII text format which is at the beginning,
after a disk label, of every PV in 2 copies by default
in large configurations...

so it is at the beginning of the pv.

The procedure I'd try (assuming I had a backup of everything, as
_this is obviously dangerous_):

1) Boot from CD and without any kind of lvm detection.
2) Destroy sda2 and recreate it as 100G.
3) Boot the system again, check that the LVM is OK and
pvresize sda2 in automatic size (so it goes from 95G to 100G).

Step 3) avoids that you have to calculate the new size for sda2,
which is very difficult because of the partition and LVM roundings.

If you find the courage to try this, let me know how it went.

:-)


--
Roberto Ragusa mail at robertoragusa.it

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 08-23-2008, 07:32 PM
Craig White
 
Default lvm resizing and shifting

Roberto Ragusa wrote:

Craig White wrote:


I was able to reduce the size of the logical volumes, move the logical
volumes so they are adjacent and then reduce the size of the physical
LVM but I cannot seem to reduce the partition itself and I'm gathering
that this may not be possible.

# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup00
PV Size 95.00 GB / not usable 31.81 MB
Allocatable yes
PE Size (KByte) 32768
Total PE 3039
Free PE 127
Allocated PE 2912
PV UUID oAYcCQ-5n28-0C6i-1LLE-voCR-E19v-SQYQK0

# fdisk -l /dev/sda

Disk /dev/sda: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00086350

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 24792 199037317+ 8e Linux LVM

# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 88G 54G 30G 65% /
/dev/sda1 99M 36M 59M 39% /boot

so in the end, /dev/sda2 remains approximately 200G and even the
gpartd-liveCD cannot resize /dev/sda2 ;-(

Is it even possible?



What you are attempting is not a common way to use the LVM system.
I often create many pv on one disk (sda2, sda3, sda4) just to avoid
this kind of problems.

The pv is now 95G, so only the first 95G of sda2 are used (usable).
Now, thinking about it, resizing sda2 could simply mean you
have to delete and immediately recreate sda2 with a smaller size.
We just have to be sure about where the pv metadata are stored.
According to

http://www.guug.de/lokal/rhein-main/2004-09-23/LVM2_sage_23.09.pdf

we learn that

LVM2 format is an ASCII text format which is at the beginning,
after a disk label, of every PV in 2 copies by default
in large configurations...

so it is at the beginning of the pv.

The procedure I'd try (assuming I had a backup of everything, as
_this is obviously dangerous_):

1) Boot from CD and without any kind of lvm detection.
2) Destroy sda2 and recreate it as 100G.
3) Boot the system again, check that the LVM is OK and
pvresize sda2 in automatic size (so it goes from 95G to 100G).

Step 3) avoids that you have to calculate the new size for sda2,
which is very difficult because of the partition and LVM roundings.

If you find the courage to try this, let me know how it went.

:-)

----
OK - makes sense and thanks for the concept.

By the way...in studying information on parted, it appears that it is
not capable of resizing an LVM partition...which explains why I couldn't
get anything done beyond lvresize/pvresize.


I'm currently backing up everything - which I probably should have done
before I ever started but clearly, the steps you outline go beyond a
simple leap of faith. Unfortunately, I am using a USB disk so the backup
is quite slow - c'est la vie


To back up, I booted from CD #1 in rescue mode and am using the
following command...


cp -ar /mnt/sysimage/* /mnt/usb

Does anyone think that there is a problem with this type of logic for
backup in terms of preserving linked files, etc?


Obviously I will have all my user files so a complete wipe and clean
re-install will only suck time but no important data and I've done it
this way in the past but I keep wondering if I should have tar'd
everything to the USB disk instead


Thanks

Craig

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 08-23-2008, 09:08 PM
Craig White
 
Default lvm resizing and shifting

On Sat, 2008-08-23 at 20:09 +0200, Roberto Ragusa wrote:
> Craig White wrote:
> > I was able to reduce the size of the logical volumes, move the logical
> > volumes so they are adjacent and then reduce the size of the physical
> > LVM but I cannot seem to reduce the partition itself and I'm gathering
> > that this may not be possible.
> >
> > # pvdisplay
> > --- Physical volume ---
> > PV Name /dev/sda2
> > VG Name VolGroup00
> > PV Size 95.00 GB / not usable 31.81 MB
> > Allocatable yes
> > PE Size (KByte) 32768
> > Total PE 3039
> > Free PE 127
> > Allocated PE 2912
> > PV UUID oAYcCQ-5n28-0C6i-1LLE-voCR-E19v-SQYQK0
> >
> > # fdisk -l /dev/sda
> >
> > Disk /dev/sda: 203.9 GB, 203928109056 bytes
> > 255 heads, 63 sectors/track, 24792 cylinders
> > Units = cylinders of 16065 * 512 = 8225280 bytes
> > Disk identifier: 0x00086350
> >
> > Device Boot Start End Blocks Id System
> > /dev/sda1 * 1 13 104391 83 Linux
> > /dev/sda2 14 24792 199037317+ 8e Linux LVM
> >
> > # df -h
> > Filesystem Size Used Avail Use% Mounted on
> > /dev/root 88G 54G 30G 65% /
> > /dev/sda1 99M 36M 59M 39% /boot
> >
> > so in the end, /dev/sda2 remains approximately 200G and even the
> > gpartd-liveCD cannot resize /dev/sda2 ;-(
> >
> > Is it even possible?
>
> What you are attempting is not a common way to use the LVM system.
> I often create many pv on one disk (sda2, sda3, sda4) just to avoid
> this kind of problems.
>
> The pv is now 95G, so only the first 95G of sda2 are used (usable).
> Now, thinking about it, resizing sda2 could simply mean you
> have to delete and immediately recreate sda2 with a smaller size.
> We just have to be sure about where the pv metadata are stored.
> According to
>
> http://www.guug.de/lokal/rhein-main/2004-09-23/LVM2_sage_23.09.pdf
>
> we learn that
>
> LVM2 format is an ASCII text format which is at the beginning,
> after a disk label, of every PV in 2 copies by default
> in large configurations...
>
> so it is at the beginning of the pv.
>
> The procedure I'd try (assuming I had a backup of everything, as
> _this is obviously dangerous_):
>
> 1) Boot from CD and without any kind of lvm detection.
> 2) Destroy sda2 and recreate it as 100G.
> 3) Boot the system again, check that the LVM is OK and
> pvresize sda2 in automatic size (so it goes from 95G to 100G).
>
> Step 3) avoids that you have to calculate the new size for sda2,
> which is very difficult because of the partition and LVM roundings.
>
> If you find the courage to try this, let me know how it went.
>
> :-)
----
well the guinea pig wants to report - it worked ! ! !

# fdisk -l /dev/sda

Disk /dev/sda: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00086350

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 12172 97667167+ 83 Linux

I have free space...(I have to go back and now and pvresize to reclaim a
few gigs from the pv but the theory was terrific)

Thanks

Craig

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 

Thread Tools




All times are GMT. The time now is 11:34 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org