EFI Multi boot setup

Multi boot setup with systemd-boot

The first step is  to create the EFI System Partition (ESP) Example:- /dev/sda1. This should preferably be the first partition and of at least 512MB type efi (Partition code EF00 in gdisk). Then create the /esp directory, mount it and move the vmlinuz-linux, intel-ucode.img and initramfs-linux.img files into the distro specific directory.

#mkdir /esp
#mount /dev/sda1 /esp
#mkdir /esp/archmain
#cd /boot
#mv * /esp/archmain

Bind Mount
This is the critical part. bind the the /boot directory to the distro specific directory so that updates to kernel, ramfs land up in the correct distro directory in the ESP.

#mount –bind /esp/archmain/ /boot
*****corresponding fstab entry
/boot/esp/archmain  /boot none defaults,bind 0 0

Setup systemd-boot
Now install systemd-boot to the ESP and configure the EFI loader

#bootctl –path=/boot install

default archmain
timeout 3

title Arch Main
linux /archmain/vmlinuz-linux
initrd /archmain/intel-ucode.img
initrd /archmain/initramfs-linux.img
options root=/dev/sda2 rw

Adding distros
For each distro use the same ESP. Just create a distro specific directory say archtest within the ESP and follow the same steps as above within the distro.

External Drive Backup – Linux Mint

If you want to periodically back up your data to an external drive then you have to do a few things:-

1. Set up the /etc/fstab file to auto mount drive on boot up
2. Make a shell script to do the actual backup [rsync]
3. Copy this shell script into cron.daily, cron.weekly ….

Thats all. Easy.

Being a Linux noob I found it easier said than done. Based on a few days of trial and error I have written this guide for noobs.

Auto Mount

Setting Auto Mount using Menu->Settings->Disks [gnome-disks] did not work for me. By default it uses a weird mount point with UUID names and rsync stalled with permission errors mostly related to FAT file system. So I resorted to manually editing the /etc/fstab file.

Open /etc/fstab

gksudo leafpad /etc/fstab

The UUID is obtained by

sudo blkid

This is the line to be inserted at the end of fstab.

#My card reader
UUID=3365-3564 /mnt/CARDBK vfat user,umask=000,utf8 0 0

Shell Script

echo "Critical" >> $LOG
echo `date` >> /home/lakshman/cronlog.txt 2>>$LOG
if [ -d $DST ]
then rsync -rlt --delete $SRC $DST 2>>$LOG
else echo "$DST does not exist" >> $LOG

The rsync flags are important. If the -a option is used which is shorthand for -rlptgoD then it will choke on FAT file systems since FAT does not support permissions and such.

Now copy this script into /etc/cron.daily

sudo cp ~/myscript.sh /etc/cron.daily


Cron can be set up by user using crontab -e command. But cron will miss cycles if the machine is Off at the cycle time. So I had to use system cron setup. The script in cron.daily is run by the cron daemon as per the /etc/crontab. This is the default crontab file

# m h dom mon dow user command
17 * * * * root run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

If the script is copied into /etc/cron.daily all the scripts in cron.daily will be run at 6.25 AM. But if the machine is not on at 6.25 AM then this cycle will be missed. Thats where anacron helps. anacron uses the /etc/anacrontab file. This is the default /etc/anacrontab file

# These replace cron's entries
1 5 cron.daily run-parts --report /etc/cron.daily
7 10 cron.weekly run-parts --report /etc/cron.weekly
@monthly 15 cron.monthly run-parts --report /etc/cron.monthly

It appears that anacron will take over the cron job and you dont have to do ANYTHING except copying the script into the cron.daily

This works for me. Now I have automated daily backups of my project files and other data to my card reader in addition to my git repositories.