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

Re: Moving LVM volume?



On Jan 01 01:54, Frank Miles (fpm@u.washington.edu) wrote:
> 
> I recently added a new hard drive to my home system.  I decided to use it
> to create an all-new bootable 'jessie' system.  I created a partition 
> table that I thought would be flexible:
>    /dev/sdb1         /   (root) {7G}
>    /dev/sdb2         /swap       {4GB}
>    /dev/sdb3         /oldjunk    {1G}
>    /dev/sdb4  extended      {remainder}
>    /dev/sdb5     LVM        {one large volume}
> 
> Most of the partitions- /usr, /home, /var, ... were in LVM2.
> 
> What I've learned since then is that /usr seems to have special
> status, and probably shouldn't be part of LVM as certain tasks
> early in the boot process can't seem to access the interior of
> LVM.

That's strange. I've been having /usr as well as / and swap, indeed
everything except /boot on LVM in countless machines since I've
forgotten when, without any particular problems (and I've often
been happy I could enlarge / or /usr without even booting).
Perhaps you could explain what are the problems you see or
anticipate with /usr under LVM?

But if you insist, a few options:

(1) You have a pretty big root partition. Perhaps you could simply
enlarge it a bit and make do without a separate /usr?
Just move swap and oldjunk to LVM, enlarge root to 12GB,
move /usr there, done.

> I've moved 'oldjunk' into the LVM, and want to expand this
> partition to become the new /usr.  I've shrunk the LVM, but
> the freed space is all at the far end of the LVM.  I have
> been unable to move it towards the end of the disk space,
> so I can expand /dev/sdb3.  gparted, resize2fs, pvmove,...
> (running from a CDROM-based rescue disk) have all failed.

(2) After shrinking LVM, create a new partition after it
and put /usr there.

(3) Take a fresh backup, reinstall with desired partitions,
restore. (You *do* have proper backups, right?)

(4) If you *really* want to move the LVM partition, it can
done but it's a seriously messy and error-prone operation.
None of the standard tools will do it automatically, AFAIK.
Outline: make sure you have a fresh backup, boot off rescue disk, make
sure LVM isn't active, move the contents inside the LVM partition in
as small pieces as necessary (depending on how much free space there
is) using dd or similar, taking care of aligments &c, then delete and
recreate partitions to match new locations (taking care not to let any
too automatic tool to mess things up), reboot, realize you've
messed up, go to step (3). :-)

-- 
Tapani Tarvainen


Reply to: