Gentoo Archives: gentoo-user

From: "Canek Peláez Valdés" <caneko@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Merging separate /usr back into / - one last time...
Date: Wed, 04 Dec 2013 00:05:45
Message-Id: CADPrc80AQPGDSVSjsLmmfk2DFVaa1u=hs2gQHk_e6TDrGt6G-Q@mail.gmail.com
In Reply to: Re: [gentoo-user] Merging separate /usr back into / - one last time... by "Jc García"
1 On Tue, Dec 3, 2013 at 5:22 PM, Jc García <jyo.garcia@×××××.com> wrote:
2 > 2013/12/3 Canek Peláez Valdés <caneko@×××××.com>:
3 >> On Tue, Dec 3, 2013 at 12:06 AM, Canek Peláez Valdés <caneko@×××××.com> wrote:
4 >>> On Mon, Dec 2, 2013 at 10:34 PM, Jc García <jyo.garcia@×××××.com> wrote:
5 >>>> 2013/12/2 William Kenworthy <billk@×××××××××.au>
6 >>>>>
7 >>>>> You are looking far too deep ....
8 >>>>>
9 >>>>>
10 >>>>> just rsync -avP to /newusr
11 >>>>
12 >>>> +1
13 >>>> I have done this more or less the same way
14 >>>>>
15 >>>>> reboot to livecd
16 >>>>>
17 >>>>> rsync again with --delete to update ... takes a only few seconds this
18 >>>>> time - minimal downtime :)
19 >>>>> mv /usr /oldusr
20 >>>>> mv /newusr /usr
21 >>>>> reboot
22 >>>>
23 >>>>
24 >>>> Let's make this thread more interesting, would it be possible to do
25 >>>> this without a reboot? ie: going single user mode, kill anything that
26 >>>> might still be running from usr, umount /usr, mount it to /mnt, rsync
27 >>>> -avP to usr, going again into runlevel 3 or 5.
28 >>>> Obviously not possible if running systemd.
29 >>>
30 >>> I'm not so sure it's not possible. Perhaps it's even easier.
31 >>
32 >> So, yeah, I think it's easier with systemd. You just:
33 >>
34 >> 1. systemctl isolate emergency.target
35 >> 2. log in again (all the normal gettys are killed with the above command)
36 >> 3. rsync -PvasHA /usr/ /newusr/
37 >> 4. mv /usr /oldusr # mv is on /bin, so no problems here
38 >> 5. mv /newusr /usr
39 >> 6. rm -rf /oldusr (to make sure nothing uses it anymore)
40 >> 7. systemctl isolate multi-user.target
41 >> 8. You have your system again.
42 >>
43 > Nice, I thought systemd residing within /usr would be the limitation,
44 > i haven't used systemd very much , so i don't really know it's options,
45 > but later after thinking about it, i thought that using the initramfs
46 > would be a way to go,
47 > but as i understand here systemd already has an option to make use of it.
48
49 Yeah, you can create an initramfs with dracut that uses systemd; the
50 initramfs mounts /usr, and then handles back control to the systemd
51 instance in it. When shutting down, the inverse occurs; the systemd in
52 /usr handles back control to the systemd in the initramfs, which in
53 turns shutdowns the machine.
54
55 I don't know exactly how problematic would be for a complex setup
56 (/usr using LVM+cryptfs+mdraid, for example), but if the necessary
57 tools are available in the initramfs, then I think it could be done.
58
59 Of course, the simplest and easiest thing to do is to use a live CD.
60
61 Regards.
62 --
63 Canek Peláez Valdés
64 Posgrado en Ciencia e Ingeniería de la Computación
65 Universidad Nacional Autónoma de México