Jay Taylor's notes
back to listing indexInstall Ubuntu 18.04 desktop with RAID 1 and LVM on machine with UEFI BIOS
[web search]With some help from How to install Ubuntu server with UEFI and RAID1 + LVM, RAID set up in Ubuntu 18.04, and RAID support in Ubuntu 18.04 Desktop installer? and How to get rid of the "scanning for btrfs file systems" at start-up?, I managed to put together a working HOWTO using linux commands only.
In short
- Download the alternate server installer.
- Install with manual partitioning, EFI + RAID and LVM on RAID partition.
- Clone EFI partition from installed partition to the other drive.
- Install second EFI partition into UEFI boot chain.
- To avoid a lengthy wait during boot in case a drive breaks, remove the
btrfs
boot scripts.
In detail
1. Download the installer
- Download the alternate server installer from http://cdimage.ubuntu.com/ubuntu/releases/bionic/release/
- Create a bootable CD or USB and boot the new machine from it.
- Select
Install Ubuntu Server
.
2. Install with manual partitioning
- During install, at the
Partition disks
step, selectManual
. - If the disks contain any partitions, remove them.
- If any logical volumes are present on your drives, select
Configure the Logical Volume Manager
.- Choose
Delete logical volume
until all volumes have been deleted. - Choose
Delete volume group
until all volume groups have been deleted.
- Choose
- If any RAID device is present, select
Configure software RAID
.- Choose
Delete MD device
until all MD devices have been deleted.
- Choose
- Delete every partition on the physical drives by choosing them and selecting
Delete the partition
.
- If any logical volumes are present on your drives, select
- Create physical partitions
- On each drive, create a 512MB partition (I've seen others use 128MB) at the beginning of the disk, Use as:
EFI System Partition
. - On each drive, create a second partition with 'max' size, Use as:
Physical Volume for RAID
.
- On each drive, create a 512MB partition (I've seen others use 128MB) at the beginning of the disk, Use as:
- Set up RAID
- Select
Configure software RAID
. - Select
Create MD device
, typeRAID1
, 2 active disks, 0 spare disks, and select the/dev/sda2
and/dev/sdb2
devices.
- Select
- Set up LVM
- Select
Configure the Logical Volume Manager
. - Create volume group
vg
on the/dev/md0
device. - Create logical volumes, e.g.
swap
at 16Groot
at 35Gtmp
at 10Gvar
at 5Ghome
at 200G
- Select
- Set up how to use the logical partitions
- For the
swap
partition, selectUse as: swap
. - For the other partitions, select
Use as: ext4
with the proper mount points (/
,/tmp
,/var
,/home
, respectively).
- For the
- Select
Finish partitioning and write changes to disk
. - Allow the installation program to finish and reboot.
3. Inspect system
Check which EFI partition has been mounted. Most likely
/dev/sda1
.mount | grep boot
Check RAID status. Most likely it is synchronizing.
cat /proc/mdstat
4. Clone EFI partition
The EFI bootloaded should have been installed on /dev/sda1
. As that partition is not mirrored via the RAID system, we need to clone it.
sudo dd if=/dev/sda1 of=/dev/sdb1
5. Insert second drive into boot chain
This step may not be necessary, since if either drive dies, the system should boot from the (identical) EFI partitions. However, it seems prudent to ensure that we can boot from either disk.
- Run
efibootmgr -v
and notice the file name for theubuntu
boot entry. On my install it was\EFI\ubuntu\shimx64.efi
. - Run
sudo efibootmgr -c -d /dev/sdb -p 1 -L "ubuntu2" -l \EFI\ubuntu\shimx64.efi
. - Now the system should boot even if either of the drives fail!
7. Wait
If you want to try to remove/disable any drive, you must first wait until the RAID synchronization has finished! Monitor the progress with cat /proc/mdstat
However, you may perform step 8 below while waiting.
8. Remove BTRFS
If one drive fails (after the synchronization is complete), the system will still boot. However, the boot sequence will spend a lot of time looking for btrfs file systems. To remove that unnecessary wait, run
sudo apt-get purge btrfs-progs
This should remove btrfs-progs
, btrfs-tools
and ubuntu-server
. The last package is just a meta package, so if no more packages are listed for removal, you should be ok.
9. Install the desktop version
Run sudo apt install ubuntu-desktop
to install the desktop version. After that, the synchronization is probably done and your system is configured and should survive a disk failure!
10. Update EFI partition after grub-efi-amd64 update
When the package grub-efi-amd64
is updated, the files on the EFI partition (mounted at /boot/efi
) may change. In that case, the update must be cloned manually to the mirror partition. Luckily, you should get a warning from the update manager that grub-efi-amd64
is about to be updated, so you don't have to check after every update.
10.1 Find out clone source, quick way
If you haven't rebooted after the update, use
mount | grep boot
to find out what EFI partition is mounted. That partition, typically /dev/sdb1
, should be used as the clone source.
10.2 Find out clone source, paranoid way
Create mount points and mount both partitions:
sudo mkdir /tmp/sda1 /tmp/sdb1
sudo mount /dev/sda1 /tmp/sda1
sudo mount /dev/sdb1 /tmp/sdb1
Find timestamp of newest file in each tree
sudo find /tmp/sda1 -type f -printf '%T+ %p\n' | sort | tail -n 1 > /tmp/newest.sda1
sudo find /tmp/sdb1 -type f -printf '%T+ %p\n' | sort | tail -n 1 > /tmp/newest.sdb1
Compare timestamps
cat /tmp/newest.sd* | sort | tail -n 1 | perl -ne 'm,/tmp/(sd[ab]1)/, && print "/dev/$1 is newest.\n"'
Should print /dev/sdb1 is newest
(most likely) or /dev/sda1 is newest
. That partition should be used as the clone source.
Unmount the partitions before the cloning to avoid cache/partition inconsistency.
sudo umount /tmp/sda1 /tmp/sdb1
10.3 Clone
If /dev/sdb1
was the clone source:
sudo dd if=/dev/sdb1 of=/dev/sda1
If /dev/sda1
was the clone source:
sudo dd if=/dev/sda1 of=/dev/sdb1
Done!
11. Virtual machine gotchas
If you want to try this out in a virtual machine first, there are some caveats: Apparently, the NVRAM that holds the UEFI information is remembered between reboots, but not between shutdown-restart cycles. In that case, you may end up at the UEFI Shell console. The following commands should boot you into your machine from /dev/sda1
(use FS1:
for /dev/sdb1
):
FS0:
\EFI\ubuntu\grubx64.efi
The first solution in the top answer of UEFI boot in virtualbox - Ubuntu 12.04 might also be helpful.
Your Answer
Not the answer you're looking for? Browse other questions tagged 18.04 system-installation uefi raid lvm or ask your own question.
-
15
-
6
Linked
Related
Hot Network Questions
-
How to prevent pickpocketing in busy bars?
-
GPLv3 forces us to make code available, but to who?
-
A word that refers to saying something in an attempt to anger or embarrass someone into doing something that they don’t want to do?
-
After viewing logs with journalctl, how do I exit the screen that says "lines 1-2/2 (END)"?
-
Top off gas with old oil, is that bad?
-
Windows 10 deletes lots of tiny files super slowly. Anything that can be done to speed it up?
-
Dynamic DataSource for Droplist in Content Editor
-
What happens to a net with the Returning Weapon artificer infusion after it hits?
-
How can I become an invalid target for spells that target humanoids?
-
What was Han searching through when he found where Lando was?
-
Is the illusion created by Invoke Duplicity affected by difficult terrain?
-
Is it ok if I haven't decided my research topic when I first meet with a potential phd advisor?
-
An impressive body of work
-
Why does Captain Marvel in the MCU not have her sash?
-
Is population size a parameter, or sample size a statistic?
-
Why is the Common Agricultural Policy unfavourable to the UK?
-
Why does it seem the best way to make a living is to invest in real estate?
-
Beyond Futuristic Technology for an Alien Warship?
-
Why would an airline put 15 passengers at once on standby?
-
Convert a string of digits from words to an integer
-
Discrepancy regarding AoE point of origin between English and German PHB
-
Lost passport and visa, tried to reapply, got rejected twice. What are my next steps?
-
Garage door sticks on a bolt
-
Detail vs. filler