[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: lvm and replacing disk



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, Sep 28, 2006 at 12:17:31PM +0000, Andy Smith wrote:
> On Thu, Sep 28, 2006 at 10:37:20AM +0200, Turbo Fredriksson wrote:
> > >>>>> "Andy" == Andy Smith <andy@lug.org.uk> writes:
> > 
> >     Andy> Yes.  I'll assue that your first disk is /dev/sda and your
> >     Andy> second one is /dev/sdb.
> > 
> > My current 400Gb is sda (SATA), the 80Gb (that will eventually be
> > removed) is hdb and my (soon to arrive - I hope :) will then be
> > sdb (also SATA).
> 
> Okay, so sda, hdb and sdb.  I'll assume the first partition of each
> is your PV, so sda1, hdb1, sdb1.
> 
> >     Andy> If your current logical volumes are small enough to all fit
> >     Andy> on /dev/sda then all you need to do is:
> > 
> > sda does NOT have enough space on it. It's already full (hence the 80Gb
> > disk). So according to the HOWTO, you just add the new disk to the
> > group/volume, move hdb to sdb (with pvmove), then remove hdb using
> > (vg,lv)reduce.
> 
> - Install sdb
> 
> - vgextend vg00 /dev/sdb1
> 
> Adds sdb1 to the volume group vg00
> 
> - pvmove -v /dev/hdb1
> 
> This moves all extents off hdb1 and onto PVs on sda1 and sdb1
> 
> - vgreduce -v vg00 /dev/hdb1
> 
> Removes hdb1 from the volume group.
> 
> >     Andy> you'll need to resize2fs to shrink filesystems
> > 
> > This part was what I didn't quite understand. Granted, i'm not sure
> > how a filesystem actually works (never needed to know :).
> 
> You don't need to shrink any filesystems or work on the level of
> filesystems at all, if you can have all 3 drives in the machine at
> once until pvmove/vgreduce is done.
> 
> > Maybe a picture will try to explain how I think/thought it worked.
> > 
> > 
> > Before the move:
> > +-------------------------+----------------+-------------------------+
> > | sda fs (~380Gb)         | hdb fs (~74Gb) | sdb fs (~380Gb) (empty) |
> > +-------------------------+----------------+-------------------------+
> 
> I do not think LVM will store its extents linearly so while at the
> moment the extents on sda1 may be exhausted and the extents on hdb1
> may be partly exhausted, the extents that make up any given file are
> likely spread across both sda1 and hdb1.
> 
> > After the move:
> > +-------------------------+----------------+-------------------------+
> > | sda fs (~380Gb)         |                | sdb fs + hdb fs         |
> > +-------------------------+----------------+-------------------------+
> > 
> > Now, if I remove the middle disk, there will be a hole in the middle,
> > so I (or resize2fs ?) needs to 'move' the content at the end (sdb+hdb
> > data) to directly AFTER the data of sda...
> 
> pvmove does this by moving LVM's extents.  This is below filesystem
> level.
> 
> > +-------------------------+-------------------------+----------------+
> > | sda fs (~380Gb)         | sdb fs + hdb fs         | fs hole+nodev  |
> > +-------------------------+-------------------------+----------------+
> > 
> > In this situation, the fs hole can now be safely removed/shrinked/reduced
> > by resize2fs...
> 
> Do not need to run resizefs.
just a note:
if you want to ajust your logical volume(s) in size to use more or less
disk space you will have to use resizefs (or other tools depending on
your fs) after growing or before shrinking the respektive lv...

if you want to create new lv's to use the new diskspace, you won't have
to use it.

yours
albert


- -- 
Albert Dengg <a_d@gmx.at>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFG9m5hrtSwvbWj0kRAsiHAJ0Q8RTCjigVikIPLq3KG00EnD8MXQCdE5IP
79vUhM8KV73P0svC3eVQHV0=
=XFE+
-----END PGP SIGNATURE-----



Reply to: