I initially installed Ubuntu Studio 20.04
onto a 120GB SSD. I'm wondering if it is possible to migrate this to RAID1 (software) with (2) 1TB SSD drives.
What's confusing me is how Ubuntu Studio 20.04
installed:
sdc 8:32 0 111.8G 0 disk
├─sdc1 8:33 0 512M 0 part /boot/efi
└─sdc2 8:34 0 111.3G 0 part /
I didn't specifically designate a /boot/efi
partition during the installation sequence.
I created (2) RAIDs:
- 2GB fat32
- 929GB ext4
I wanted to make the fat32 partition larger than it would ever require to avoid re-partitioning the drive in the future.
To copy the files onto the RAID partitions I used:
rsync -avP --numeric-ids --delete-during {120GB partition} {equivalent RAID1 partition}
Additionally I edited /etc/fstab
# / was on /dev/sda2 during installation
UUID=a461ff1b-8d74-4e24-84e7-fe17e2097f23 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda1 during installation
UUID=06A9-23FB /boot/efi vfat umask=0077 0 1
/swapfile none swap sw 0 0
However this won't boot. I am not sure if it can be salvaged. Was there a different way I was suppose to copy the boot partition?
This is the results of lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 2G 0 part
│ └─md127 9:127 0 2G 0 raid1
└─sda2 8:2 0 929.5G 0 part
└─md126 9:126 0 929.4G 0 raid1
sdb 8:16 0 931.5G 0 disk
├─sdb1 8:17 0 2G 0 part
│ └─md127 9:127 0 2G 0 raid1
└─sdb2 8:18 0 929.5G 0 part
└─md126 9:126 0 929.4G 0 raid1
sdc 8:32 0 111.8G 0 disk
├─sdc1 8:33 0 512M 0 part /boot/efi
└─sdc2 8:34 0 111.3G 0 part /
I want to set this up so Ubuntu Studio 20.04 will boot from both partitions --- so if 1 SSD dies I can still boot the computer and then replace the SSD.
After much research and help from the folks on the Freenode #Ubuntu IRC channel I have an answer. I ended up re-installing due to all the research and failed attempts. I've shared my process below. For those who will use this to migrate to RAID use
rsync -avP --numeric-ids --delete-during /path/from/ /path/to/
for cloning your installed operating system and data (documents, videos, photos, etc.)I've treated this as many single board computers requiring a microsd card to boot. I setup the
/boot/efi
partition on a mSATA with a USB adapter I'll Velcro to my computer case.To make this work I booted the live media and accessed terminal (
CTRL ALT T
) usedcfdisk
to create the Linux RAID partitions on each SSD drives for the RAIDsudo cfdisk /dev/sdLETTER
"Select Tabel Type":
gpt
[New]
Partition size:
###G
[Type] Find
Linux RAID
[Write] "Are you sure you want to write the partition table to disk?"
yes
[Quit]
Then eject, unmount or otherwise power off each SSD and reconnect them. Note what
/dev/sdLETTER
were assigned usinglsblk
Next
sudo apt install mdadm
and create the RAID1mdadm --create /dev/md/rootfs /dev/sdLETTER1 /dev/sdLETTER1 --level=1 --raid-devices=2
To monitor the creation of the RAID use:
cat /proc/mdstat
When complete format the RAID using
mkfs.ext4 -m0 /dev/md/rootfs
While the RAID is being created create create the
/boot/efi
partition:Mount the device you will use the
/boot/efi
partition. I used a mSATA with USB adapter.Use
lsblk
to identify the assigned/dev/sdLETTER
.Create the partition using
cfdisk
steps above.As the live media for installing Ubuntu 20.04 don't allow formatting using terminal do so with
mkfs.vfat
Once the RAID has been created use the Ubuntu 20.04 live media installation command to install selecting
/dev/md127
(or the equivalent/dev/
mount assigned). Select the/boot/efi
partition. Proceed with the installation.The final step of the installation where
grub
boot is created will fail. I created this manually using:My grub-install syntax was more complex:
Any time new Kernels are installed you will need to edit /etc/fstab to ensure the UUID= matches your RAID and not /dev/sda1. To fix this mistake:
First confirm the UUID of your RAID parition and /dev/sda1 parition:
To display the incorrect UUID assigned:
Then boot using live media. Access terminal to install and activate RAID:
The RAID partition should auto mount. To get the location of the audio mount use:
You will be looking for something like:
/dev/md127 916G 82G 789G 10% /media/ubuntu-studio/f3c747fb-63d8-455d-8815-6097e1f35d58
If not:
Finally correct the UUID to match your RAID for "/":
My entry is: