* [linux-lvm] vgscan --force-all-update-reread-and-take-that-kernel
@ 2006-06-28 15:12 Tristan Van Berkom
2006-06-28 16:25 ` [linux-lvm] " Tristan Van Berkom
0 siblings, 1 reply; 3+ messages in thread
From: Tristan Van Berkom @ 2006-06-28 15:12 UTC (permalink / raw)
To: linux-lvm
[-- Attachment #1: Type: text/plain, Size: 1866 bytes --]
Hello lvm folks,
Before I give you the whole shpiel... the issue I am having here
is that vgscan is unable to find an existing volume group after
a repartitioning of the disk using 'parted' (hence the subject line that
implies that vgscan needs an option to slap the kernel a little harder
in some cases).
I am using lvm to automaticly extend a logical partition
to span the "rest of the harddisk", in the case that there are
some unused gigs on the disk.
I've written a little script (which I'll attach here) that
basicly:
- Resizes the extended partition
- Creates a new logical partition in the newly allocated space
inside the extended partition
- Creates a new "physical volume" on the new partition
- Adds the new "physical volume" to the already existing "volume group"
- Extends the "logical volume" to span the entire "volume group"
The script works fine it you type it all out by hand in the shell and
wait a few secs and repeatedly check vgscan to see if its back up,
when I run the script... I get:
From when I first issue a vgscan:
=================================
Reading all physical volumes. This may take a while...
No volume groups found
From my next call to pvcreate:
==============================
Couldn't find device with uuid 'HAkK8E-D3CS-87kk-GtL0-6ZGC-1NKI-x65WQg'.
Couldn't find all physical volumes for volume group massgaol.
Couldn't find device with uuid 'HAkK8E-D3CS-87kk-GtL0-6ZGC-1NKI-x65WQg'.
Couldn't find all physical volumes for volume group massgaol.
get_pv_from_vg_by_id: vg_read failed to read VG massgaol
Physical volume "/dev/hdb7" successfully created
Anyway, I guess at this point y'all know what I'm rambling on about...
please let me know what I'm doing wrong or what I could be doing
better :)
Cheers,
-Tristan
[-- Attachment #2: jukebox_resize --]
[-- Type: text/plain, Size: 1782 bytes --]
#!/bin/bash
# This scrip makes some evil assumptions:
#
# o That the disk was partitioned as 120 Gigs
# o That the real disk size will be reported as numGB (in Gigs)
# (i.e. this wont work if parted decides to display it in terabytes
# or megabytes on some disks)
#
OUTPATTERN="Disk /dev/hdb: "
DISKOUT=`parted /dev/hdb print | grep "$OUTPATTERN"`
DISKSIZE=${DISKOUT#$OUTPATTERN}
echo "this disk size is $DISKSIZE"
echo "that would be ${DISKSIZE%GB} Gigs I think"
DISKGIGS=${DISKSIZE%GB}
if [ $DISKGIGS -gt 120 ]; then
# Found a disk that is physically bigger than 120GB
# Resize the extended partition to span till the end of the disk
parted /dev/hdb resize 4 3208MB $DISKSIZE
# Create /dev/hdb7 with the remaining disk space
parted /dev/hdb mkpart logical 120GB $DISKSIZE
# XXX massgaol dissapears here for a few secs....
sleep 2
vgscan
# Give the system some time to create the fs nodes needed
# to proceed
sleep 5
# Create a physical volume for
pvcreate -y -ff /dev/hdb7
# Adding more ...
sleep 2
# Scan volume groups... needed to make 'massgaol' recognized
# in the next step.
vgscan
# Add new physical volume to the volume group
vgextend massgaol /dev/hdb7
# Get the current size of the virtual group now...
# (get the 12'th field, separated by ':').
VGSIZE=`vgdisplay -c massgaol | cut -d : -f12`
# Activate the group -- this creates /dev/massgaol/massgaolLV
vgchange -ay
# Extend the logical volume to span the entire volume group
lvextend /dev/massgaol/massgaolLV -L${VGSIZE}KB
# Resize sometimes wants an fsck first.
e2fsck -f /dev/massgaol/massgaolLV
# Resize the overlying filesystem
resize2fs /dev/massgaol/massgaolLV
# deactivate the group for now
vgchange -an
fi
^ permalink raw reply [flat|nested] 3+ messages in thread* [linux-lvm] Re: vgscan --force-all-update-reread-and-take-that-kernel
2006-06-28 15:12 [linux-lvm] vgscan --force-all-update-reread-and-take-that-kernel Tristan Van Berkom
@ 2006-06-28 16:25 ` Tristan Van Berkom
2006-07-02 14:26 ` Michael Loftis
0 siblings, 1 reply; 3+ messages in thread
From: Tristan Van Berkom @ 2006-06-28 16:25 UTC (permalink / raw)
To: Tristan Van Berkom; +Cc: linux-lvm
Tristan Van Berkom wrote:
> Hello lvm folks,
Hi again...
seems I have found a way to make the script work, by making the
"volume group" active throughout the whole procedure.
So, before I commit that and close this book... is what I am doing
insane ? is it crazy to go and add a new physical volume to a volume
group that is living and breathing ? (i.e. "active" via `vgchange -ay')
Cheers,
-Tristan
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [linux-lvm] Re: vgscan --force-all-update-reread-and-take-that-kernel
2006-06-28 16:25 ` [linux-lvm] " Tristan Van Berkom
@ 2006-07-02 14:26 ` Michael Loftis
0 siblings, 0 replies; 3+ messages in thread
From: Michael Loftis @ 2006-07-02 14:26 UTC (permalink / raw)
To: LVM general discussion and development
--On June 28, 2006 12:25:48 PM -0400 Tristan Van Berkom <tvb@gnome.org>
wrote:
> Tristan Van Berkom wrote:
>> Hello lvm folks,
>
> Hi again...
> seems I have found a way to make the script work, by making the
> "volume group" active throughout the whole procedure.
>
> So, before I commit that and close this book... is what I am doing
> insane ? is it crazy to go and add a new physical volume to a volume
> group that is living and breathing ? (i.e. "active" via `vgchange -ay')
Yes. That's part of the whole point of LVM, it's operations can all be
done online.
>
> Cheers,
> -Tristan
>
> _______________________________________________
> linux-lvm mailing list
> linux-lvm@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
>
--
"Genius might be described as a supreme capacity for getting its possessors
into trouble of all kinds."
-- Samuel Butler
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-07-02 14:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-28 15:12 [linux-lvm] vgscan --force-all-update-reread-and-take-that-kernel Tristan Van Berkom
2006-06-28 16:25 ` [linux-lvm] " Tristan Van Berkom
2006-07-02 14:26 ` Michael Loftis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).