Gentoo Archives: gentoo-user

From: Alex Schuster <wonko@×××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] InitRAMFS - boot expert sought
Date: Wed, 28 Mar 2012 16:44:01
Message-Id: 20120328184112.227f4252@weird.wonkology.org
In Reply to: Re: [gentoo-user] InitRAMFS - boot expert sought by Allan Gottlieb
1 Allan Gottlieb writes:
2
3 > On Tue, Mar 27 2012, Alan McKinnon wrote:
4
5 > > Move partitions after / on the disk out of the way creating enough
6 > > free space to contain current / and /usr.
7 >
8 > Question. /dev/sda7 is LVM and that is used for /usr, /local, et al.
9 > How do I move an LVM partition? I could make plain partitions and just
10 > copy /usr, /opt, et al., each to a separate partition. Is that the way?
11
12 So you have free space after /dev/sda7? Just create some more partitions,
13 use pvcreate to make them physical volumes, then vgextend to add them to
14 your LVM. Then use pvmirror to move stuff over.
15 Assuming you create two more partitions /dev/sda8 and /dev/sda9:
16 pvcreate /dev/sda[89]
17 vgextend myvg /dev/sda[89]
18 pvmove /dev/sda7
19 vgreduce myvg /dev/sda7
20
21 When I use LVM, I always use many small partitions for it, instead of one
22 large one. This gives more flexibility in case on needs to enlarge a
23 standard partition, or to add such a partition in case something else has
24 to be installed alongside Gentoo. pvmove then allows to free a partition.
25
26 > > Enlarge / partition, enlarge the file system on it, copy contents
27 > > of /usr there.
28 >
29 > / is ext3, which I believe can be extended live. Or do you recommend
30 > using a gentoo install CD (or equivalent)?
31
32 ext3 can be enlargend while in use, but your partition can not. You can
33 enlarge the root partition after the contents of /dev/sda7 have been
34 moved, using [c]fdisk or whatever tool you like, but you need to reboot
35 for the kernel to see the new size. That would be no problem with root on
36 LVM, but then you also need an initramfs :)
37 BTW, I just had this problem when installing Ubuntu desktop on a big
38 server. For the first time in my life, I simply let the installer decide
39 about partitioning. What could possibly go wrong, it's a 73G drive, a
40 single root partition would do, user data is mounted via NFS. But that
41 night at home I got an email that the root FS was full after installing
42 some packages. The installer created a 5G partition only, and 68G of swap,
43 probably because the machine has 64G of RAM. The Ubuntu installer does
44 not know of LVM, so I had to manually reboot the machine the next day.
45
46 > > Arrange the rest of your disk the way you want it (either with or
47 > > without LVM, both are easy enough to do).
48 > > Move the rest of your data back to it's final destination.
49 > > Delete any last remnants of the old /usr partition.
50 >
51 > This part seems straight forward and not scary since I still would have
52 > the newly created and copied /usr, /opt, et al. partitions in case
53 > something goes wrong.
54
55 pvmove seems to be considered safe. Just reboot after enlarging the root
56 partition, then use resize2fs /dev/sda5 to make the FS larger. Then
57 copy /usr over:
58 mount -o bind / /mnt
59 mount -o remount,ro /usr
60 cp -a /usr/* /mnt/
61 The bind moun t makes the root FS appear in a 2nd place, without /usr
62 being populated by the content of your /usr partition.
63 Don't forget to remove /usr from /etc/fstab.
64
65 > I believe this is one of the configurations others have adopted, which I
66 > consider a plus. The other favored configuration is to keep the current
67 > partition scheme and use an initramfs via genkernel, dracut, or Neil's
68 > "in kernel config" soln.
69
70 That's how I do it, but that's mainly because my whole system is
71 encrypted. BTW, this does not seem to be supported at this moment, at
72 least not with genkernel, there is no option to mount an encrypted /usr.
73 So I just created another LVM, unencrypted, and copied my /usr there.
74 Encrypting /usr does not make too much sense anyway. I also have the
75 problem now that I see an error while booting because /usr cannot be
76 fscked, but I will care about this later.
77
78 > I would suspect there are second order improvements such as moving
79 > /usr/portage and /usr/src to LVM with symlinks left behind in /usr, but
80 > I am now just concerned to see if I have the basic plan correct.
81 > Have I?
82
83 Sort of.
84 I also have portage stuff on another partition (well, on two, the tree
85 has its tiny extra partition), using /var/portage. I don't use symlinks,
86 but changed the portage paths in /etc/make.conf, and
87 re-created /etc/make.profile.
88
89 Wonko

Replies

Subject Author
Re: [gentoo-user] InitRAMFS - boot expert sought Simon <turner25@×××××.com>