<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="https://dev1galaxy.org/extern.php?action=feed&amp;tid=2323&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Dev1 Galaxy Forum / LVM and/or RAID with refractainstaller]]></title>
		<link>https://dev1galaxy.org/viewtopic.php?id=2323</link>
		<description><![CDATA[The most recent posts in LVM and/or RAID with refractainstaller.]]></description>
		<lastBuildDate>Mon, 20 Aug 2018 20:22:25 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: LVM and/or RAID with refractainstaller]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=11453#p11453</link>
			<description><![CDATA[<p><strong>RAID - LUKS - LVM</strong> </p><p>This method uses one encrypted raid array with lvm on top of it, so you only have to enter one password to unlock the encrypted volume. </p><p><strong>Partition</strong> two disks, each with a small partition for boot and a large partition for the array.<br />If you use gpt with bios boot, add a third partition, greater than 1M, unformatted, with EF02 or bios_grub flag.<br />If you use uefi, add a third partition, 100-500M, fat32, EF00 or esp and boot flags.</p><p>This example uses the first partition for the boot array and the second partition for the system array.<br />(The second array for /boot is optional. See notes on full-disk encryption at the end of this post.)</p><p><strong>Create the arrays.</strong> </p><p>Don&#039;t use names like /dev/md0, /dev/md1...&#160; If you do, cryptsetup will complain during update-initramfs. Use names like /dev/md/mdroot1 and /dev/md/mdboot1. (Note: the digit at the end is for refractainstaller, and it&#039;s really only needed on the unencrypted /boot. Any logical partitions in the lvm will have mapper names, and you can end those with a digit.)</p><div class="codebox"><pre><code>mdadm --create -v /dev/md/mdroot1 -l1 -n2 /dev/sda2 /dev/sdb2
mdadm --create -v /dev/md/mdboot1 -l1 -n2 /dev/sda1 /dev/sdb1</code></pre></div><p><strong>Encrypt the root array</strong>, /dev/md/mdroot1, then open it and give it a name, like crypt</p><div class="codebox"><pre><code>cryptsetup luksFormat /dev/md/mdroot1
cryptsetup luksOpen /dev/md/mdroot1 crypt</code></pre></div><p><strong>Set up LVM on the encrypted volume.</strong> The lv name sould end in a digit to make the installer happy.</p><div class="codebox"><pre><code>pvcreate /dev/mapper/crypt
vgcreate vol0 /dev/mapper/crypt
lvcreate -L 5G vol0 -n  lvroot1
lvcreate -l +100%FREE vol0 -n lvhome1</code></pre></div><p><strong>Run refractainstaller.</strong> </p><p>Enter the following devices when the installer asks for the locations of /boot, operating system and /home.</p><p>/boot&#160; &#160; &#160; <span class="bbc"> /dev/md/mdboot1</span><br />/&#160; &#160; &#160; &#160; &#160; &#160; <span class="bbc">/dev/mapper/vol0-lvroot1</span><br />/home&#160; &#160; <span class="bbc">/dev/mapper/vol0-lvhome1</span></p><p>At the pause, switch to another console or terminal and do the following:</p><div class="codebox"><pre><code># save md detail to /etc/mdadm/mdadm.conf
mdadm --detail --scan /dev/md/mdboot1 &gt;&gt; /target/etc/mdadm/mdadm.conf
mdadm --detail --scan /dev/md/mdroot1 &gt;&gt; /target/etc/mdadm/mdadm.conf

# edit /target/etc/crypttab to add the following line:
crypt	    /dev/md/mdroot1    none    luks

# edit /target/etc/cryptsetup-initramfs/conf-hook so it says:
CRYPTSETUP=y

# rebuild the initramfs:
chroot /target update-initramfs -u</code></pre></div><p>Return to installer and proceed.</p><p><strong>RAID1 - LUKS - LVM with FULL DISK ENCRYPTION</strong> (no separate unencrypted boot)</p><p>This is the same as the above,except for the following:<br />&#160; - don&#039;t make a separate array for /boot<br />&#160; - don&#039;t enter a partition for /boot in the installer<br />&#160; - at the pause, edit /target/etc/default/grub and add the following line:</p><div class="codebox"><pre><code>GRUB_ENABLE_CRYPTODISK=y</code></pre></div><p>Run update-initramfs after you have edited all the files.</p><p>When you reboot, you should be asked for the password twice - once before you see the grub menu and once when the system is booting. Grub is slow to recognize the password. Be patient. Don&#039;t press ENTER a second time, or your boot menu will disappear too fast for you to select anything other than the default boot.</p><p><strong>Slow Shutdown Fix</strong><br />When you get tired of waiting for your encrypted system to shut down, see this post for a fix:<br /><a href="https://dev1galaxy.org/viewtopic.php?pid=8289#p8289" rel="nofollow">https://dev1galaxy.org/viewtopic.php?pid=8289#p8289</a></p>]]></description>
			<author><![CDATA[dummy@example.com (fsmithred)]]></author>
			<pubDate>Mon, 20 Aug 2018 20:22:25 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=11453#p11453</guid>
		</item>
		<item>
			<title><![CDATA[Re: LVM and/or RAID with refractainstaller]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=11440#p11440</link>
			<description><![CDATA[<p><strong>LVM on RAID1</strong></p><p><strong>Partition disks</strong> as in the first post.</p><div class="codebox"><pre><code>mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
pvcreate /dev/md0
vgcreate vol0 /dev/md0
lvcreate -L 5G vol0 -n lvroot1
lvcreate -l +100%FREE vol0 -n lvhome2</code></pre></div><p><strong>Run refractainstaller</strong><br />Choose a partition for the operating system:&#160; <span class="bbc">/dev/mapper/vol0-lvroot1</span><br />Choose a partition for /home: <span class="bbc">/dev/mapper/vol0-lvhome2</span></p><p>At pause, before installing bootloader<br />go to another vt and run:</p><div class="codebox"><pre><code>chroot /target
mdadm --detail --scan /dev/md0 &gt;&gt; /etc/mdadm/mdadm.conf
update-initramfs -u
exit</code></pre></div><p>Proceed with installer. (install GRUB)</p>]]></description>
			<author><![CDATA[dummy@example.com (fsmithred)]]></author>
			<pubDate>Sun, 19 Aug 2018 20:03:02 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=11440#p11440</guid>
		</item>
		<item>
			<title><![CDATA[Re: LVM and/or RAID with refractainstaller]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=11438#p11438</link>
			<description><![CDATA[<p><strong>INSTALL TO LVM</strong></p><p><strong>Create the physical volume and volume group.</strong><br />You can use a whole disk or you can use a partition. This example uses a whole disk.</p><div class="codebox"><pre><code>pvcreate /dev/sda
pvscan  # or pvdisplay  # This is just to see what you did.
vgcreate vol0 /dev/sda
vgscan # or vgdisplay</code></pre></div><p><strong>Create the logical volumes</strong> (the partition scheme for your filesystem).</p><p>The next commands will create a 25G partition named lvroot and a second partition that uses the rest of the space, named lvhome.</p><div class="codebox"><pre><code>lvcreate -L 25G vol0 -n lvroot
lvcreate -l +100%FREE vol0 -n lvhome</code></pre></div><p><strong>Run refractainstaller.</strong><br />Choose a partition for the operating system:&#160; <span class="bbc">/dev/mapper/vol0-lvroot</span><br />Choose a partition for /home: <span class="bbc">/dev/mapper/vol0-lvhome</span></p><p>Note: When the installer asks if you want the partition encrypted, you could say yes, but you will have to enter a password for each encrypted partition. Also, the encrypted root and home partitions will be named /dev/mapper/root_fs and /dev/mapper/home_fs in /etc/fstab.</p><p>When the installer is finished, remove the live media and reboot.</p><p>NEXT: LVM on RAID1</p>]]></description>
			<author><![CDATA[dummy@example.com (fsmithred)]]></author>
			<pubDate>Sun, 19 Aug 2018 19:36:55 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=11438#p11438</guid>
		</item>
		<item>
			<title><![CDATA[LVM and/or RAID with refractainstaller]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=11437#p11437</link>
			<description><![CDATA[<p>The cli version of refractainstaller has a couple of characteristics that make it possible to use it in non-standard ways. <br />1. You have to type in the device name when choosing partitions.<br />2. The installer pauses before installing the bootloader. This allows you to chroot the installed system to make changes manually.</p><p>While lvm and raid are not explicitly supported by the installer, it is possible to do either or both. Here are some examples. These examples use /dev/sda and /dev/sdb. You must change that if you use different drives.</p><p>In all cases, I installed the grub bootloader to the mbr of /dev/sda. </p><p><strong>Important note regarding encryption:</strong> If you encrypt a raid array or lvm and your root partition or home partition is contained within that volume, tell the installer &quot;no&quot; when it asks if you want to encrypt that partition.</p><p><strong>INSTALL TO RAID1 (mirrored)</strong></p><p><strong>Partitioning</strong><br />There are several ways to do this. You can create the array from whole disks (/dev/sda and /dev/sdb) or you can create it from two partitions (/dev/sda1 and /dev/sdb1). If you use whole disks, there will be no room at the beginning of the disk for grub, and you will need another disk for the bootloader. Also, if you use whole disks, you can then partition the array, and you will use partitions like /dev/md0p1, /dev/md0p2 during the installation.</p><p>For this example, partition two disks with at least one partition on each. Make them the same size. You can use either gpt or msdos partition tables. If you have uefi hardware, you need an efi partition somewhere. We&#039;ll install the whole system into one partition.</p><p>(Note: gpt with bios boot requires an unformatted partition, at least 1MB in size with bios_grub flag, or ef02) </p><p>(Note 2: refractainstaller can only recognize separate /boot, /home and / (root) partitions. There&#039;s a way to have more, but I haven&#039;t tested it with this. See /etc/refractainstaller.conf.)</p><p>(Note 3: refractainstaller asks for a partition and then tests to see that it ends in a non-zero digit. That means if you call your array /dev/md0 and try to use that as a single partition, it will fail. Call it /dev/md1 instead.</p><p><strong>Create the raid</strong> (use the partitions, not the whole device.)</p><div class="codebox"><pre><code>mdadm --create --verbose /dev/md1 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
cat /proc/mdstat   # this is just to let you see that it worked</code></pre></div><p><strong>Run refractainstaller</strong> (please use the -d option for a better error log)</p><div class="codebox"><pre><code>refractainstaller -d</code></pre></div><p>The installer will ask where to put the operating system. Enter <span class="bbc">/dev/md1</span><br />(Note: we only made one partition, so don&#039;t enter anything for /boot or /home)<br />The installer will ask if you want the partition encrypted. You can say yes if you want, and it will work. (You don&#039;t need a separate /boot partition. See the notes on full-disk encryption at the end of&#160; <a href="https://dev1galaxy.org/viewtopic.php?pid=11453#p11453" rel="nofollow">this post.</a>)<br />The installer will pause when the installed system is ready for chroot. That pause looks something like this:</p><div class="quotebox"><blockquote><div><p>The installed system is ready for chroot. (proc, sys, dev are mounted)<br />&#160; &#160; If you want, you may work in another virtual terminal.<br />&#160; &#160; Make a selection when you are ready to proceed.</p><p>&#160; &#160; ${bios_boot_warning}</p><p>&#160; &#160; Choices (enter number)<br />&#160; &#160; &#160; &#160; 1 or 2)&#160; (Install bootloader or copy files and install bootloader)<br />&#160; &#160; &#160; &#160; 3) Continue without a bootloader.<br />&#160; &#160; &#160; &#160; 4) Abort the installation and exit.</p></div></blockquote></div><p>Do not choose anything yet. Go to another console or another tab in your terminal and get root. Then run the following commands. </p><div class="codebox"><pre><code>chroot /target
mdadm --detail --scan /dev/md1 &gt;&gt; /etc/mdadm/mdadm.conf
update-initramfs -u
exit</code></pre></div><p>Return to the console or terminal where the installer is running, and make the appropriate choice. (usually, you want to install a bootloader.) Continue until the installer is finished. Reboot (remember to remove the live media).</p><p>References:<br /><a href="https://www.digitalocean.com/community/tutorials/how-to-create-raid-arrays-with-mdadm-on-ubuntu-16-04" rel="nofollow">https://www.digitalocean.com/community/ … untu-16-04</a><br /><a href="https://dev1galaxy.org/viewtopic.php?pid=10954#p10954" rel="nofollow">https://dev1galaxy.org/viewtopic.php?pid=10954#p10954</a>&#160; (Thanks for trying it first, stroudmw.)<br /><a href="https://www.howtoforge.com/linux_lvm" rel="nofollow">https://www.howtoforge.com/linux_lvm</a><br /><a href="https://wiki.archlinux.org/index.php/LVM" rel="nofollow">https://wiki.archlinux.org/index.php/LVM</a><br /><a href="https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system#LVM_on_LUKS" rel="nofollow">https://wiki.archlinux.org/index.php/Dm … VM_on_LUKS</a></p><p>Next: LVM</p>]]></description>
			<author><![CDATA[dummy@example.com (fsmithred)]]></author>
			<pubDate>Sun, 19 Aug 2018 19:36:29 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=11437#p11437</guid>
		</item>
	</channel>
</rss>
