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

Re: Moving LVM volume?



Frank Miles a écrit :
> 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.

It is not clear that LVM is the issue here. On a Wheezy system with
traditional sysv-init (I know Jessie is different and uses systemd
instead), LVM is started before filesystems in /etc/fstab are mounted.
The issue may be that some init tasks now require /usr to be mounted
early. In this case, pulling /usr from the LVM may not help.

I read an interesting paper from a systemd developper (sorry, forgot the
URL), stating that /usr was more and more required for some early init
tasks, and the conclusion was :
- Early userspace tasks are performed in the initramfs, so there is no
real reason to separate /usr from / on most systems and to the
distinction between /bin, /sbin, /lib and their counterparts in /usr.
- If you really want a separate /usr, it should be mounted in early
userspace (initramfs) just like /.

Some distributions now merge the contents of /lib, /bin and /sbin into
/usr and replaces them with symlinks. I found it a rather interesting
approach, because it still allows to have a mostly read-only /usr
containing all the binaries, whereas the read-write root does not
contain any binary any more.

> 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.

KISS : don't bother with moving partitions.
- Put /usr on the root partition. 7 GB should be enough. You can grab 1
more GB from oldjunk if needed (delete swap and oldjunk, extend root,
recreate swap).
or
- Create a new logical partition in the free space at the end of the
disk and use it as /usr.


Reply to: