Skip to content

Instantly share code, notes, and snippets.

@samrocketman
Last active July 17, 2021 15:31
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samrocketman/9677ca29e0fbaab8f8e55ebc3039172a to your computer and use it in GitHub Desktop.
Save samrocketman/9677ca29e0fbaab8f8e55ebc3039172a to your computer and use it in GitHub Desktop.
Configure KUbuntu 16.04 with RAID0

Notes for my system:

  • I couldn't get legacy boot to work. Only UEFI (using an EFI System Partition aka EPS).
  • The EPS can't be on the RAID0. You must allocate ~200 megabytes to the EPS.
  • KUbuntu installer was so buggy that I couldn't use it. Use Ubuntu to set up the system and then install kubuntu-desktop package.
  • When chrooting the EPS must be mounted on /boot/efi.
  • I recommend using Ubuntu 16.04 inside of virtualbox to create a startup boot disk on USB of Ubuntu 16.04 ISO. At first a tried using an earlier version of KUbuntu and it took a lot of trial/error to discover I shouldn't have done that.

Resources:

Boot the live disk and open a terminal; login to root.

apt install mdadm grub-efi-amd64-signed

Prepare devices

I'm using 4 SSD drives with device names sda, sdb, sdc, sdd.

Clear the partition tables.

for x in a b c d;do sgdisk -z /dev/sd${x};done

Configure sda with partitions and copy the partitions to the rest of the devices.

sgdisk -n 1:0:+30M -t 1:ef00 -c 1:"EFI System" /dev/sda
sgdisk -N 2 -t 2:fd00 -c 2:"Linux RAID" /dev/sda
for x in b c d;do sgdisk /dev/sda -R /dev/sd${x} -G;done

RAID0

Note: Sometimes when changing the partitions you may need to use partprobe to notify the kernel or reboot.

Create RAID0 array from disks. (from 4th partition on all disks)

mdadm --create /dev/md0 --level=0 --raid-disks=4 /dev/sd[abcd]2

Partition the RAID device.

sgdisk -z /dev/md0
sgdisk -N 1 -t 1:8300 -c 1:"Linux filesystem" /dev/md0

Run the installer

I found the installer unreliable unless I ran it as root.

sudo ubiquity -b

Choose manual partition during installation and...

  • Set /dev/sda1 to be EFI.
  • /dev/md0p1 to be the / partition formatted to EXT4 filesystem.
  • Boot Loader /dev/sda.
  • Reformat /dev/sd[bcd]1 to be EXT4 rather than EPS so that there's only one EPS partition for the installation.

To keep it simple no advanced configurations such as LVM or disk encryption were used. That doesn't mean you can't.

Postinst chroot to install missing packages

Your installation needs at a minimum mdadm package installed. Without it the system can't boot.

chroot in:

mount /dev/md0p1 /mnt
mount /dev/sda1 /mnt/boot/efi
mount -o bind /dev /mnt/dev
mount -o bind /dev/pts /mnt/dev/pts
mount -o bind /sys /mnt/sys
mount -o bind /proc /mnt/proc
cp /etc/resolv.conf /mnt/etc/resolv.conf
chroot /mnt

Install missing packages inside of chroot.

apt install mdadm grub-efi-amd64-signed

Modify /etc/mdadm/mdadm.conf and remove label references.

Reboot and enjoy.

@samrocketman
Copy link
Author

@samrocketman
Copy link
Author

samrocketman commented May 21, 2016

new way

sgdisk -n 1:0:+512M -t 1:8300 -c 1:"Linux /boot" /dev/sda
sgdisk -N 2 -t 2:fd00 -c 2:"Linux RAID" /dev/sda
mdadm --create /dev/md0 --level=0 --raid-disks=4 /dev/sd[abcd]2
sgdisk -z /dev/md0
sgdisk -N 1 -t 1:8300 -c 1:"Linux filesystem" /dev/md0

Run the installer and set /dev/sda1 to /boot and /dev/md0p1 to /.

old way

#support both legacy and EFI boot
sgdisk -n 1:0:+1M -t 1:ef02 -c 1:"BIOS Boot" /dev/sda
sgdisk -n 2:0:+200M -t 2:ef00 -c 2:"EFI System" /dev/sda
sgdisk -n 3:0:+512M -t 3:8300 -c 3:"Linux /boot" /dev/sda
sgdisk -N 4 -t 4:fd00 -c 4:"Linux RAID" /dev/sda
for x in b c d;do sgdisk /dev/sda -R /dev/sd${x} -G;done

Partition the EFI boot device.

mkfs.fat -F 32 /dev/sda2
mkdir /tmp/sda2
mount /dev/sda2 /tmp/sda2
mkdir /tmp/sda2/EFI
umount /dev/sda2

@samrocketman
Copy link
Author

samrocketman commented May 21, 2016

Try again

sgdisk -n 1:0:+200M -t 1:ef00 -c 1:"EFI System" /dev/sda
sgdisk -N 2 -t 2:fd00 -c 2:"Linux RAID" /dev/sda
for x in b c d;do sgdisk /dev/sda -R /dev/sd${x} -G;done
mkfs.fat -F 32 /dev/sda1
mkdir /tmp/sda1
mount /dev/sda1 /tmp/sda1
mkdir /tmp/sda1/EFI
umount /dev/sda1

@samrocketman
Copy link
Author

samrocketman commented May 21, 2016

nVidia Video

  • Install proprietary drivers through "Additional Drivers" utility.
  • Reboot
  • Configure SLI with sudo nvidia-xconfig --sli=on
  • Reboot
  • Open nVidia utility and look at the first GPU. The Screen should show some information and SLI if SLI is enabled.

old junk

Configure nVidia drivers by downloading from the website and http://askubuntu.com/questions/149206/how-to-install-nvidia-run

Enable SLI.

http://us.download.nvidia.com/XFree86/Linux-x86/180.22/README/chapter-25.html

Xorg -configure
nvidia-xconfig --sli=on

@samrocketman
Copy link
Author

samrocketman commented May 21, 2016

Install kubuntu-desktop

Reference: http://askubuntu.com/questions/621284/unmet-dependencies-when-trying-to-install-kde-plasma-5-3-on-ubuntu-15-04

apt install kubuntu-desktop
dpkg -P unity-scope-gdrive
dpkg -P account-plugin-google
dpkg -P account-plugin-facebook
apt-get install -f

Then reboot.

@samrocketman
Copy link
Author

tmpfs for /tmp

Add to /etc/fstab.

#6GB tmpfs since we have 32GB RAM.
tmpfs /tmp tmpfs nodev,nosuid,size=6G 0 0

My final /etc/fstab looks like:

# / was on /dev/md0p1 during installation
UUID=7aec663c-35a4-4c96-a738-121b96e13f94 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda1 during installation
UUID=797B-D31F /boot/efi vfat umask=0077 0 1
#6GB tmpfs since we have 32GB RAM.
tmpfs /tmp tmpfs nodev,nosuid,size=6G 0 0

/dev/md0p1 is my RAID0 partition. /boot/efi is my separate UEFI system partition.

@samrocketman
Copy link
Author

samrocketman commented May 30, 2016

After installing it seems all I needed was only a few megabytes for the EFI System Partition (EPS).

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       197M  1.1M  196M   1% /boot/efi

Next time only give 10MB to EPS. e.g.

sgdisk -n 1:0:+11M -t 1:ef00 -c 1:"EFI System" /dev/sda
sgdisk -N 2 -t 2:fd00 -c 2:"Linux RAID" /dev/sda

@samrocketman
Copy link
Author

samrocketman commented Jun 15, 2016

SLI is broken on Linux. I returned one of my video cards because of this.

@samrocketman
Copy link
Author

samrocketman commented Jul 9, 2016

Fix google accounts in telepathy on KDE.

https://gist.github.com/samrocketman/9677ca29e0fbaab8f8e55ebc3039172a#gistcomment-1783226

apt-get install --reinstall kaccounts-integration kaccounts-providers kde-telepathy-kaccounts

http://askubuntu.com/questions/490690/how-to-fix-apparmor-denied-for-telepathy-mission-control-5-under-ubuntu-14-04

ln -s /etc/apparmor.d/usr.lib.telepathy /etc/apparmor.d/disable/
#use aa-status command to confirm it is disabled after reboot
aa-status

@samrocketman
Copy link
Author

samrocketman commented Jul 15, 2016

Test write speed of disk.

dd if=/dev/zero of=./test oflag=dsync status=progress bs=1000M

Note: not all versions of dd support the above options. Use your man pages to figure out what is appropriate for your system.

@samrocketman
Copy link
Author

samrocketman commented Apr 4, 2019

KDE Neon

This is the latest up-to-date process for KDE Neon install (should also work for Ubuntu 18.04).

Some notes:

  • When running the installer, customize the storage and remove all non-boot EFI partitions.
  • When running the installer on a RAID setup it will crash at the end. This is normal. You'll have to manually chroot into the installed system and grub-install the bootloader. It crashes because of the grub-install failure due to missing packages required for RAID.

High level:

  1. Create RAID setup.
  2. Reboot
  3. Assemble raid array mdadm -As
  4. Run installer.
  5. Customize the storage
    • remove all non-boot EFI partitions
    • The boot loader must be installed within the same drive as the EFI partition.
    • Format /dev/md0p1 to be the / drive of the install.
  6. chroot into the system and install mdadm grub-efi-amd64-signed packages
  7. grub-install /dev/sdb or whatever drive the EFI partition is located while inside of the chroot.

Create RAID setup

Follow https://gist.github.com/samrocketman/9677ca29e0fbaab8f8e55ebc3039172a#gistcomment-1783179

Delete the duplicate EFI partitions

for x in b c d; do sgdisk --delete=1 /dev/sd"$x"1;done

The EFI partition must be formatted (in this example /dev/sda1 is the EFI partition).

mkfs.vfat /dev/sda1

Reboot

Reboot the system and boot back into the live disk. After rebooting re-assemble the RAID array. As root, run the following.

apt-get update
apt-get install mdadm grub-efi-amd64-signed
mdadm -As

Run through installer

But don't forget to chroot, install the packages, and the run update-grub2 and grub-install /dev/sda.

GRUB Recovery

Documented in How to Rescue a Non-booting GRUB 2 on Linux.

Getting a grub prompt but no Linux boot. Run the following commands to recover from the grub> prompt.

List the known drives.

grub> ls

Check and verify the right disk.

grub> ls (md/0,gpt1)/
grub> cat (md/0,gpt1)/etc/issue

Boot from grub (tab complete available)

grub> set root=(md/0,gpt1)
grub> linux /boot/vmlinuz-3.13.0-29-generic root=/dev/md0p1
grub> initrd /boot/initrd.img-3.13.0-29-generic
grub> boot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment