From: Tristan Van Berkom <tvb@gnome.org>
To: linux-lvm@redhat.com
Subject: [linux-lvm] vgscan --force-all-update-reread-and-take-that-kernel
Date: Wed, 28 Jun 2006 11:12:32 -0400 [thread overview]
Message-ID: <44A29C60.8020709@gnome.org> (raw)
[-- 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
next reply other threads:[~2006-06-28 15:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-28 15:12 Tristan Van Berkom [this message]
2006-06-28 16:25 ` [linux-lvm] Re: vgscan --force-all-update-reread-and-take-that-kernel Tristan Van Berkom
2006-07-02 14:26 ` Michael Loftis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44A29C60.8020709@gnome.org \
--to=tvb@gnome.org \
--cc=linux-lvm@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.