Allan Gottlieb writes:

> On Tue, Mar 27 2012, Alan McKinnon wrote:

> > Move partitions after / on the disk out of the way creating enough
> > free space to contain current / and /usr.
> 
> Question.  /dev/sda7 is LVM and that is used for /usr, /local, et al.
> How do I move an LVM partition?  I could make plain partitions and just
> copy /usr, /opt, et al., each to a separate partition.  Is that the way?

So you have free space after /dev/sda7? Just create some more partitions,
use pvcreate to make them physical volumes, then vgextend to add them to
your LVM. Then use pvmirror to move stuff over.
Assuming you create two more partitions /dev/sda8 and /dev/sda9:
        pvcreate /dev/sda[89]
        vgextend myvg /dev/sda[89]
        pvmove /dev/sda7
        vgreduce myvg /dev/sda7

When I use LVM, I always use many small partitions for it, instead of one
large one. This gives more flexibility in case on needs to enlarge a
standard partition, or to add such a partition in case something else has
to be installed alongside Gentoo. pvmove then allows to free a partition.

> > Enlarge / partition, enlarge the file system on it, copy contents
> > of /usr there.
> 
> / is ext3, which I believe can be extended live.  Or do you recommend
> using a gentoo install CD (or equivalent)?

ext3 can be enlargend while in use, but your partition can not. You can
enlarge the root partition after the contents of /dev/sda7 have been
moved, using [c]fdisk or whatever tool you like, but you need to reboot
for the kernel to see the new size. That would be no problem with root on
LVM, but then you also need an initramfs :)
BTW, I just had this problem when installing Ubuntu desktop on a big
server. For the first time in my life, I simply let the installer decide
about partitioning. What could possibly go wrong, it's a 73G drive, a
single root partition would do, user data is mounted via NFS. But that
night at home I got an email that the root FS was full after installing
some packages. The installer created a 5G partition only, and 68G of swap,
probably because the machine has 64G of RAM. The Ubuntu installer does
not know of LVM, so I had to manually reboot the machine the next day.

> > Arrange the rest of your disk the way you want it (either with or
> > without LVM, both are easy enough to do).
> > Move the rest of your data back to it's final destination.
> > Delete any last remnants of the old /usr partition.
> 
> This part seems straight forward and not scary since I still would have
> the newly created and copied /usr, /opt, et al. partitions in case
> something goes wrong.

pvmove seems to be considered safe. Just reboot after enlarging the root
partition, then use resize2fs /dev/sda5 to make the FS larger. Then
copy /usr over:
        mount -o bind / /mnt
        mount -o remount,ro /usr
        cp -a /usr/* /mnt/
The bind moun t makes the root FS appear in a 2nd place, without /usr
being populated by the content of your /usr partition.
Don't forget to remove /usr from /etc/fstab.

> I believe this is one of the configurations others have adopted, which I
> consider a plus.  The other favored configuration is to keep the current
> partition scheme and use an initramfs via genkernel, dracut, or Neil's
> "in kernel config" soln.

That's how I do it, but that's mainly because my whole system is
encrypted. BTW, this does not seem to be supported at this moment, at
least not with genkernel, there is no option to mount an encrypted /usr.
So I just created another LVM, unencrypted, and copied my /usr there.
Encrypting /usr does not make too much sense anyway. I also have the
problem now that I see an error while booting because /usr cannot be
fscked, but I will care about this later.

> I would suspect there are second order improvements such as moving
> /usr/portage and /usr/src to LVM with symlinks left behind in /usr, but
> I am now just concerned to see if I have the basic plan correct.
> Have I?

Sort of.
I also have portage stuff on another partition (well, on two, the tree
has its tiny extra partition), using /var/portage. I don't use symlinks,
but changed the portage paths in /etc/make.conf, and
re-created /etc/make.profile.

        Wonko

Reply via email to