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

Re: lvm and replacing disk



On Wed, Sep 27, 2006 at 08:59:37PM +0200, Turbo Fredriksson wrote:
> Now, in a 'not to distant future' that second disk I've just added will
> have to be replaced (it's just a 80Gb and I've ordered a second 400Gb disk).
> The HOWTO doesn't talk (yet again) about resize2fs.
> 
> It say to ADD the new disk to the group/volume, then MOVE the data from
> the second (in my case) disk to the third and then REMOVE the old disk.
> But if I do that, there will be a hole (?) in the filesystem... ?
> Am I confused?

Yes.  I'll assue that your first disk is /dev/sda and your second
one is /dev/sdb.

If your current logical volumes are small enough to all fit on
/dev/sda then all you need to do is:

# pvmove -v /dev/sdb

That will reallocate all used extents onto /dev/sda.  You can then
remove sdb from the volume group:

# vgreduce vg00 /dev/sdb

You can now turn the computer off and remove /dev/sdb.

If you don't have enough space on sda to take all your current
logical volumes then you'll need to resize2fs to shrink filesystems,
then lvreduce to shrink the corresponding logical volumes until they
do fit.

If there is no way for you reduce the filesystems enough then you
are going to have to put the third disk in and add it to the volume
group before doing the pvmove to shift extents off of sdb (some will
go to sda and some to the new disk).

Cheers,
Andy

-- 
http://strugglers.net/wiki/Xen_hosting -- A Xen VPS hosting hobby
Encrypted mail welcome - keyid 0x604DE5DB

Attachment: signature.asc
Description: Digital signature


Reply to: