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

Re: Moving LVM volume?



On Thu, 1 Jan 2015 18:13:11 +0000 (UTC)
Frank Miles <fpm@u.washington.edu> wrote:

> On Thu, 01 Jan 2015 11:30:02 +0100, Joe wrote:
> 
> > On Thu, 1 Jan 2015 01:54:39 +0000 (UTC)
> > 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.
> >> 
> >> 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.
> >> 
> >> Is there some method that I've overlooked?
> >> 
> > Is the system installed and running yet? If so, check the space
> > used by the main mountpoints. Almost certainly, /usr is the largest
> > of the system partitions. My workstation /usr is about 8GB, and I
> > don't have any modern games. Excluding /home, the total is just
> > over 10GB.
> > 
> > Next, there's no problem having the entire system on LVM, including
> > /boot. I still have a /boot partition, for legacy reasons, but the
> > rest is in one LVM volume, indeed in a single partition apart
> > from /home. On a workstation, there's no great advantage to using
> > separate partitions for anything else.
> > 
> > Next, unless you want to mess with the building of the boot
> > ramdisk, the issue with /usr is that it must be mounted at the same
> > time as the root partition gets mounted during boot, so it needs to
> > be physically stored under /, and any separate /usr partition will
> > still potentially have problems. At the moment, I'm not aware of
> > any show-stoppers caused by having a separate /usr, but I've no
> > doubt it will happen in time.
> > 
> > To be honest, unless you already have a significant investment in
> > the new system, I'd suggest starting again.
> > 
> > --
> > Joe
> 
> Thanks to everyone (Joe,Joel,Pascal,Tapani,Mark,...) for your
> interesting replies.  In response to your answers and questions:
> 
> I've been using the new-drive-system (jessie) for a bit over a week.  
> With the stock kernel it's mostly functional though 'systemctl status'
> is whining about being 'degraded'.  I probably wouldn't have
> discovered that if my custom-kernel efforts* weren't failing in
> mysterious ways. I was hoping that cleaning up the boot process would
> resolve the deeper mysteries without having to think or work too hard.
> 
> /usr is currently taking ~11G.  So there's not enough space to simply
> merge the primary partitions and have / and /usr live on that.  I do
> too many different kinds of things to limit it - I expect it to grow,
> possibly double in the next couple of years (and at that point this
> system will probably get replaced anyway.  the new disk is mainly to
> keep this old system doddering along for a bit longer)
> 
> My proximal backup is the original disk, and I have tried to keep that
> unaltered in developing the new system.  I haven't (yet) backed-up to
> my external backup drive - that's a bit of a pain to setup.  I've had
> drives fail on me, don't want to use that as /usr.  I certainly
> wouldn't trust a USB drive as /usr.
> 
> I guess I'm going to have to reinstall jessie from scratch.  This
> will take time as my network link is a slow DSL :(  The alternatives
> don't sound appealing.  I have a lot of customization of my machines
> - hey, if I just wanted to do what everyone else did I could run
> Windows.
> 
> So thanks again for your replies - I am at least satisfied that I've
> made a reasonable effort to 'fix' the problems.  I will have to think
> some more about LVM - it seems like a great idea, but possibly not
> the best option for my particular circumstances.
> 

I think I would probably use LVM rather than not, but to be honest I've
only made use of its features once over several machines and several
years. It really comes into its own on servers with multiple drives,
multiple data partitions and the need for snapshots.

You might consider the other way of merging / and /usr, doing it within
the LVM volume. I'm assuming that as it's a new drive, there are
hundreds of GB free. It's a bit messier to do, and you need to re-do the
grub setup, but it avoids a lot of downloading and there's probably not
that much in the current /. /lib is probably the biggest item, at
something like 150MB per kernel.

It leaves the current / partition a bit obsolete. I can't remember the
full capabilities of LVM, but you might be able to absorb it into the
LVM volume, or at least configure it as another LVM volume and make a
set with the existing one. It might also be possible to move swap into a
partition or even a file in LVM, delete the primaries and extend sdb5
into the free space, then extend the LVM volume. Once you've made the
decision to reinstall you don't have much to lose by first exploring
the possibilities of LVM in solving your problem more easily.

Another thought is that if you do reinstall and you haven't cleaned up
the apt cache since you built the system, many of the current packages
may be there. It may well be possible to set up a temporary local
repository and again avoid a lot of downloading.

-- 
Joe


Reply to: