Gentoo Archives: gentoo-user

From: "Canek Peláez Valdés" <caneko@×××××.com>
To: gentoo-user@l.g.o
Subject: LVM2+mdraid+systemd (was Re: [gentoo-user] systemd and lvm)
Date: Fri, 20 Sep 2013 08:46:32
Message-Id: CADPrc83Fs7tgUwTvb-TO4zX+22xTUEtifaMDnhVio7WWAVk87w@mail.gmail.com
1 On Fri, Sep 13, 2013 at 7:42 AM, Stefan G. Weichinger <lists@×××××.at> wrote:
2 > Am 12.09.2013 20:23, schrieb Canek Peláez Valdés:
3 >
4 >> Stefan, what initramfs are you using?
5 >
6 > dracut, run via your kerninst-script.
7 >
8 >> Could you please explain how is exactly your layout? From drives to
9 >> partitions to PVs, VGs and LVs? And throw in there also the LUKS and
10 >> RAID (if used) setup. I will try to replicate that in a VM. Next week,
11 >> since we have a holiday weekend coming.
12 >
13 > thanks for your offer.
14 >
15 > I wil happily list my setup BUT let me tell at first that the latest
16 > sys-fs/lvm2-2.02.100 seems to have fixed that semaphore-issue.
17 >
18 > After booting my desktop with it I quickly tested:
19 >
20 > # lvcreate -n test -L1G VG03
21 > Logical volume "test" created
22 > #
23 >
24 > fine!
25 >
26 > Three times ok ...
27 >
28 > But I still face the fact that the LVs weren't activated at boot time.
29 > Manual "vgchange -ay" needed ... or that self-written lvm.service
30 > enabled as mentioned somewhat earlier.
31 >
32 > Here my setup:
33 >
34 > # lsblk
35 > NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
36 > sda 8:0 0 931,5G 0 disk
37 > ├─sda1 8:1 0 2M 0 part
38 > ├─sda2 8:2 0 2G 0 part [SWAP]
39 > ├─sda3 8:3 0 600G 0 part
40 > │ └─md127 9:127 0 595,1G 0 raid1
41 > │ ├─VG03-music 253:0 0 190G 0 lvm /mnt/music
42 > │ ├─VG03-platz 253:1 0 200G 0 lvm /mnt/platz
43 > │ ├─VG03-media 253:2 0 45G 0 lvm /mnt/media
44 > │ ├─VG03-home 253:3 0 30G 0 lvm
45 > │ ├─VG03-oopsfiles 253:4 0 12G 0 lvm /mnt/oopsfiles
46 > │ ├─VG03-dropbox 253:5 0 5G 0 lvm /mnt/dropbox
47 > │ ├─VG03-distfiles 253:6 0 10G 0 lvm /usr/portage/distfiles
48 > │ ├─VG03-gentoo32 253:7 0 15G 0 lvm /mnt/gentoo32
49 > │ ├─VG03-xp 253:8 0 40G 0 lvm
50 > │ └─VG03-test 253:9 0 1G 0 lvm
51 > └─sda6 8:6 0 50G 0 part
52 > └─md4 9:4 0 50G 0 raid1
53 > sdb 8:16 0 931,5G 0 disk
54 > ├─sdb1 8:17 0 100M 0 part
55 > ├─sdb2 8:18 0 98,8G 0 part
56 > ├─sdb3 8:19 0 50G 0 part
57 > │ └─md4 9:4 0 50G 0 raid1
58 > ├─sdb4 8:20 0 12,4G 0 part
59 > └─sdb6 8:22 0 595,1G 0 part
60 > └─md127 9:127 0 595,1G 0 raid1
61 > ├─VG03-music 253:0 0 190G 0 lvm /mnt/music
62 > ├─VG03-platz 253:1 0 200G 0 lvm /mnt/platz
63 > ├─VG03-media 253:2 0 45G 0 lvm /mnt/media
64 > ├─VG03-home 253:3 0 30G 0 lvm
65 > ├─VG03-oopsfiles 253:4 0 12G 0 lvm /mnt/oopsfiles
66 > ├─VG03-dropbox 253:5 0 5G 0 lvm /mnt/dropbox
67 > ├─VG03-distfiles 253:6 0 10G 0 lvm /usr/portage/distfiles
68 > ├─VG03-gentoo32 253:7 0 15G 0 lvm /mnt/gentoo32
69 > ├─VG03-xp 253:8 0 40G 0 lvm
70 > └─VG03-test 253:9 0 1G 0 lvm
71 > sdc 8:32 0 55,9G 0 disk
72 > ├─sdc1 8:33 0 25G 0 part /
73 > ├─sdc2 8:34 0 2G 0 part
74 > └─sdc3 8:35 0 28,9G 0 part /home
75 > sr0 11:0 1 1024M 0 rom
76 >
77 >
78 >
79 > This pretty much says it all, right?
80 >
81 > 2 hdds sda and sdb
82 > 1 ssd sdc
83 >
84 > root-fs and /home on ssd ...
85 >
86 > sda and sdb build two RAID-arrays (rather ugly names and partitions ...
87 > grown over time):
88 >
89 > # cat /proc/mdstat
90 > Personalities : [raid1]
91 > md4 : active raid1 sdb3[0] sda6[2]
92 > 52395904 blocks super 1.2 [2/2] [UU]
93 >
94 > md127 : active raid1 sdb6[0] sda3[1]
95 > 623963072 blocks [2/2] [UU]
96 >
97 > unused devices: <none>
98 >
99 >
100 > # pvs
101 > PV VG Fmt Attr PSize PFree
102 > /dev/md127 VG03 lvm2 a-- 595,05g 47,05g
103
104 Sorry I took my time, I was busy.
105
106 Well, yours' a complex setup. This is a similar, although simpler, version:
107
108 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
109 sr0 11:0 1 1024M 0 rom
110 vda 253:0 0 5G 0 disk
111 |-vda1 253:1 0 95M 0 part /boot
112 |-vda2 253:2 0 1.9G 0 part [SWAP]
113 `-vda3 253:3 0 3G 0 part /home
114 vdb 253:16 0 5G 0 disk
115 `-vdb1 253:17 0 5G 0 part /
116 vdc 253:32 0 5G 0 disk
117 `-vdc1 253:33 0 5G 0 part
118 `-md127 9:127 0 5G 0 raid1
119 |-vg-vol1 (dm-0) 254:0 0 2G 0 lvm /home/canek/Music
120 |-vg-vol2 (dm-1) 254:1 0 2G 0 lvm /home/canek/Pictures
121 `-vg-vol3 (dm-2) 254:2 0 1020M 0 lvm /home/canek/Videos
122 vdd 253:48 0 5G 0 disk
123 `-vdd1 253:49 0 5G 0 part
124 `-md127 9:127 0 5G 0 raid1
125 |-vg-vol1 (dm-0) 254:0 0 2G 0 lvm /home/canek/Music
126 |-vg-vol2 (dm-1) 254:1 0 2G 0 lvm /home/canek/Pictures
127 `-vg-vol3 (dm-2) 254:2 0 1020M 0 lvm /home/canek/Videos
128
129 /boot on vda1 as ext2, / (root) on vdb1 as ext4, /home on vda3 as
130 ext4, vda2 as swap, and vdc1 and vdd1 as md127 raid1, from which a PV
131 is created, and from it a VG, and from it vol1, vol2 and vol3 are 3
132 LVs. The LVs are mounted inside /home which is mounted inside /
133 (root), to see if it could cause troubles.
134
135 Again, everything just works. I did not touch one single configuration
136 file for LVM2, mdadm, nor almost anything else. Since /boot is outside
137 of mdraid and/or LVM2, it was even simpler that my last experiment.
138
139 What I did:
140
141 1. The partitions used for mdraid (vdc1 and vdd1) are of type "Linux
142 raid autodetect" (fd in fdisk).
143
144 2. The raid and LVM2 volumes were created following (more or less)
145 [1]. I did not mknod nothing, mdadm --create does everything.
146
147 3. I did *NOT* used --metadata=0.90 when creating md1.
148
149 4. I used mkfs.ext[24] -L *always*. All the mounted partitions/LVs
150 that I use have labels; even the swap partition is labeled.
151
152 5. My fstab:
153
154 LABEL=Root / ext4 acl,noatime 0 1
155 LABEL=Boot /boot ext2 acl,noatime 0 2
156 LABEL=Home /home ext4 acl,noatime 0 2
157 LABEL=Music /home/canek/Music ext4 acl,noatime 0 2
158 LABEL=Pictures /home/canek/Pictures ext4 acl,noatime 0 2
159 LABEL=Videos /home/canek/Videos ext4 acl,noatime 0 2
160 LABEL=Swap none swap sw 0 0
161 shm /dev/shm tmpfs nodev,nosuid,noexec 0 0
162 tmpfs /tmp tmpfs defaults,nosuid,size=100% 0 0
163
164 Music/Pictures/Videos are the LVs inside the raid; they have labels. I
165 do not put anything special in fstab, I just put the label.
166
167 6. In /etc/portage/make.conf:
168
169 DRACUT_MODULES="caps systemd lvm mdraid"
170
171 7. USE flags:
172
173 sys-kernel/dracut device-mapper
174 sys-boot/grub device-mapper mount
175
176 8. In /etc/dracut.conf:
177
178 add_dracutmodules+="lvm mdraid systemd"
179
180 I didn't modified lvmconf nor mdadmconf, so both are by default set to "no".
181
182 9. In /etc/default/grub:
183
184 GRUB_PRELOAD_MODULES="mdraid1x"
185
186 10. I compiled the kernel with the options suggested by [1] and [2].
187 make, make install, make modules_install
188
189 11. I generated my initramfs with: dracut -f -H /boot/initrd-3.10.7 3.10.7
190
191 12. GRUB2: grub2-mkconfig -o /boot/grub2/grub.cfg
192
193 13. I repeat, I didn't touched /etc/lvm/lvm.conf, nor /etc/mdadm.conf.
194
195 Versions installed:
196
197 sys-apps/systemd-204
198 sys-boot/grub-2.00_p5107-r1
199 sys-fs/lvm2-2.02.100-r2
200 sys-fs/mdadm-3.3
201 sys-kernel/dracut-033 (compile with USE="optimization")
202 sys-kernel/vanilla-sources-3.11.1
203
204 Everything just works. I didn't needed to search for service files for
205 LVM2 nor for mdraid; the ones installed by the package (and the
206 generated one using generators) just worked.
207
208 I masked the following unit files, since they are not installed in my
209 Virtual Machine:
210
211 cryptsetup.target
212 fcoe.service
213 iscsi.service
214
215 I also masked lvm2-activation-net.service, since it gave me a failure
216 (lvm2-activation-net.service: main process exited, code=exited,
217 status=5/NOTINSSTALLED); however everything works and the LVs get
218 mounted automatically.
219
220 Since /usr is not even in its own partition, the initramfs is not
221 necessary; I can boot just fine without it.
222
223 lvm ~ # systemctl status home-canek-Music.mount
224 home-canek-Music.mount - /home/canek/Music
225 Loaded: loaded (/etc/fstab)
226 Active: active (mounted) since Fri 2013-09-20 03:40:41 CDT; 1min 38s ago
227 Where: /home/canek/Music
228 What: /dev/mapper/vg-vol1
229 Process: 1271 ExecMount=/bin/mount /dev/disk/by-label/Music
230 /home/canek/Music -t ext4 -o acl,noatime (code=exited,
231 status=0/SUCCESS)
232
233 Sep 20 03:40:41 lvm systemd[1]: Mounting /home/canek/Music...
234 Sep 20 03:40:41 lvm systemd[1]: Mounted /home/canek/Music.
235
236 lvm ~ # systemd-analyze blame
237 949ms systemd-udev-trigger.service
238 161ms systemd-fsck@dev-disk-by\x2dlabel-Pictures.service
239 142ms systemd-fsck@dev-disk-by\x2dlabel-Home.service
240 135ms systemd-fsck-root.service
241 131ms systemd-fsck@dev-disk-by\x2dlabel-Boot.service
242 105ms sshd.service
243 100ms lvm2-activation-early.service
244 96ms systemd-logind.service
245 95ms systemd-fsck@dev-disk-by\x2dlabel-Music.service
246 95ms sys-kernel-debug.mount
247 95ms dhcpcd@××××××.service
248 92ms systemd-vconsole-setup.service
249 90ms systemd-fsck@dev-disk-by\x2dlabel-Videos.service
250 90ms dev-hugepages.mount
251 88ms systemd-tmpfiles-setup-dev.service
252 86ms dev-mqueue.mount
253 73ms lvm2-activation.service
254 66ms mdadm.service
255 55ms home-canek-Music.mount
256 52ms systemd-sysctl.service
257 42ms boot.mount
258 39ms systemd-remount-fs.service
259 39ms systemd-user-sessions.service
260 38ms systemd-tmpfiles-setup.service
261 32ms home.mount
262 31ms systemd-journal-flush.service
263 29ms systemd-udev-settle.service
264 27ms home-canek-Pictures.mount
265 24ms systemd-random-seed-load.service
266 22ms home-canek-Videos.mount
267 21ms tmp.mount
268 18ms systemd-udevd.service
269 12ms dev-disk-by\x2dlabel-Swap.swap
270
271 Again, I don't see what the problem is. Now I have installed Gentoo in
272 a virtual machine with everything using LVM2 (even /boot), and in
273 another using LVM2+mdraid. I suppose I just need to try
274 LVM2+mdraid+LUKS.
275
276 Regards.
277
278 [1] http://www.gentoo.org/doc/en/gentoo-x86+raid+lvm2-quickinstall.xml
279 [2] https://wiki.gentoo.org/wiki/LVM
280 --
281 Canek Peláez Valdés
282 Posgrado en Ciencia e Ingeniería de la Computación
283 Universidad Nacional Autónoma de México

Replies

Subject Author
Re: LVM2+mdraid+systemd (was Re: [gentoo-user] systemd and lvm) "Stefan G. Weichinger" <lists@×××××.at>
Re: LVM2+mdraid+systemd (was Re: [gentoo-user] systemd and lvm) "Stefan G. Weichinger" <lists@×××××.at>