<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.iwillfearnoevil.com/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Ubuntu-raid-live-os</id>
	<title>Ubuntu-raid-live-os - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.iwillfearnoevil.com/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Ubuntu-raid-live-os"/>
	<link rel="alternate" type="text/html" href="https://wiki.iwillfearnoevil.com/mediawiki/index.php?title=Ubuntu-raid-live-os&amp;action=history"/>
	<updated>2026-05-08T15:50:16Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.2</generator>
	<entry>
		<id>https://wiki.iwillfearnoevil.com/mediawiki/index.php?title=Ubuntu-raid-live-os&amp;diff=19&amp;oldid=prev</id>
		<title>Chubbard at 19:52, 15 October 2021</title>
		<link rel="alternate" type="text/html" href="https://wiki.iwillfearnoevil.com/mediawiki/index.php?title=Ubuntu-raid-live-os&amp;diff=19&amp;oldid=prev"/>
		<updated>2021-10-15T19:52:32Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:52, 15 October 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[https://feeding.cloud.geek.nz/posts/setting-up-raid-on-existing/ | Original source site]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[https://feeding.cloud.geek.nz/posts/setting-up-raid-on-existing/|Original source site]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Tested and works, but is really touchy on getting it right.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Tested and works, but is really touchy on getting it right.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key mediawiki:diff::1.12:old-18:rev-19 --&gt;
&lt;/table&gt;</summary>
		<author><name>Chubbard</name></author>
	</entry>
	<entry>
		<id>https://wiki.iwillfearnoevil.com/mediawiki/index.php?title=Ubuntu-raid-live-os&amp;diff=18&amp;oldid=prev</id>
		<title>Chubbard at 19:52, 15 October 2021</title>
		<link rel="alternate" type="text/html" href="https://wiki.iwillfearnoevil.com/mediawiki/index.php?title=Ubuntu-raid-live-os&amp;diff=18&amp;oldid=prev"/>
		<updated>2021-10-15T19:52:20Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:52, 15 October 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[ https://feeding.cloud.geek.nz/posts/setting-up-raid-on-existing/ | Original source site]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[https://feeding.cloud.geek.nz/posts/setting-up-raid-on-existing/ | Original source site]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Tested and works, but is really touchy on getting it right.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Tested and works, but is really touchy on getting it right.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key mediawiki:diff::1.12:old-17:rev-18 --&gt;
&lt;/table&gt;</summary>
		<author><name>Chubbard</name></author>
	</entry>
	<entry>
		<id>https://wiki.iwillfearnoevil.com/mediawiki/index.php?title=Ubuntu-raid-live-os&amp;diff=17&amp;oldid=prev</id>
		<title>Chubbard: Created page with &quot;[ https://feeding.cloud.geek.nz/posts/setting-up-raid-on-existing/ | Original source site]  Tested and works, but is really touchy on getting it right.  &lt;pre&gt; Adjust howto for...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.iwillfearnoevil.com/mediawiki/index.php?title=Ubuntu-raid-live-os&amp;diff=17&amp;oldid=prev"/>
		<updated>2021-10-15T19:52:03Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;[ https://feeding.cloud.geek.nz/posts/setting-up-raid-on-existing/ | Original source site]  Tested and works, but is really touchy on getting it right.  &amp;lt;pre&amp;gt; Adjust howto for...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[ https://feeding.cloud.geek.nz/posts/setting-up-raid-on-existing/ | Original source site]&lt;br /&gt;
&lt;br /&gt;
Tested and works, but is really touchy on getting it right.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Adjust howto for your RAID preference.  Tested successfully on Ubuntu 20, non-uefi, BIOS mode Raid1 mode&lt;br /&gt;
&lt;br /&gt;
Before you start, make sure the following packages are installed:&lt;br /&gt;
&lt;br /&gt;
apt-get install mdadm rsync initramfs-tools&lt;br /&gt;
&lt;br /&gt;
Then go through these steps:&lt;br /&gt;
&lt;br /&gt;
    Partition the new drive.&lt;br /&gt;
    Create new degraded RAID arrays.&lt;br /&gt;
    Install GRUB2 on both drives.&lt;br /&gt;
    Copy existing data onto the new drive.&lt;br /&gt;
    Reboot using the RAIDed drive and test system.&lt;br /&gt;
    Wipe the original drive by adding it to the RAID array.&lt;br /&gt;
    Test booting off of the original drive.&lt;br /&gt;
    Resync drives.&lt;br /&gt;
    Test booting off of the new drive.&lt;br /&gt;
    Reboot with the two drives and resync the array.&lt;br /&gt;
&lt;br /&gt;
(My instructions are mostly based on this old tutorial but also on this more recent one.)&lt;br /&gt;
1- Partition the new drive&lt;br /&gt;
&lt;br /&gt;
Once you have connected the new drive (/dev/sdb), boot into your system and use one of cfdisk or fdisk to display the partition information for the existing drive (/dev/sda on my system).&lt;br /&gt;
&lt;br /&gt;
The idea is to create partitions of the same size on the new drive. (If the new drive is bigger, leave the rest of the drive unpartitioned.)&lt;br /&gt;
&lt;br /&gt;
Partition types should all be: fd (or &amp;quot;linux raid autodetect&amp;quot;).&lt;br /&gt;
2- Create new degraded RAID arrays&lt;br /&gt;
&lt;br /&gt;
The newly partioned drive, consisting of a root and a swap partition, can be added to new RAID1 arrays using mdadm:&lt;br /&gt;
&lt;br /&gt;
mdadm --create /dev/md0 --level=1 --raid-devices=2 missing /dev/sdb1  &lt;br /&gt;
mdadm --create /dev/md1 --level=1 --raid-devices=2 missing /dev/sdb2&lt;br /&gt;
&lt;br /&gt;
and formatted like this:&lt;br /&gt;
&lt;br /&gt;
mkswap /dev/md1  &lt;br /&gt;
mkfs.ext4 /dev/md0&lt;br /&gt;
&lt;br /&gt;
Specify these devices explicitly in /etc/mdadm/mdadm.conf:&lt;br /&gt;
&lt;br /&gt;
DEVICE /dev/sda* /dev/sdb*&lt;br /&gt;
&lt;br /&gt;
and append the RAID arrays to the end of that file:&lt;br /&gt;
&lt;br /&gt;
mdadm --detail --scan &amp;gt;&amp;gt; /etc/mdadm/mdadm.conf  &lt;br /&gt;
dpkg-reconfigure mdadm&lt;br /&gt;
&lt;br /&gt;
You can check the status of your RAID arrays at any time by running this command:&lt;br /&gt;
&lt;br /&gt;
cat /proc/mdstat&lt;br /&gt;
&lt;br /&gt;
3- Install GRUB2 on both drives&lt;br /&gt;
&lt;br /&gt;
The best way to ensure that GRUB2, the default bootloader in Debian and Ubuntu, is installed on both drives is to reconfigure its package:&lt;br /&gt;
&lt;br /&gt;
dpkg-reconfigure grub-pc&lt;br /&gt;
&lt;br /&gt;
and select both /dev/sda and /dev/sdb (but not /dev/md0) as installation targets.&lt;br /&gt;
&lt;br /&gt;
This should cause the init ramdisk (/boot/initrd.img-2.6.32-5-amd64) and the grub menu (/boot/grub/grub.cfg) to be rebuilt with RAID support.&lt;br /&gt;
4- Copy existing data onto the new drive&lt;br /&gt;
&lt;br /&gt;
Copy everything that's on the existing drive onto the new one using rsync:&lt;br /&gt;
&lt;br /&gt;
mkdir /tmp/mntroot  &lt;br /&gt;
mount /dev/md0 /tmp/mntroot  &lt;br /&gt;
rsync -auHxv --exclude=/proc/* --exclude=/sys/* --exclude=/tmp/* /* /tmp/mntroot/&lt;br /&gt;
&lt;br /&gt;
5- Reboot using the RAIDed drive and test system&lt;br /&gt;
&lt;br /&gt;
Before rebooting, open /tmp/mntroot/etc/fstab, and change /dev/sda1 and /dev/sda2 to /dev/md0 and /dev/md1respectively.&lt;br /&gt;
&lt;br /&gt;
Then reboot and from within the GRUB menu, hit &amp;quot;e&amp;quot; to enter edit mode and make sure that you will be booting off of the new disk:&lt;br /&gt;
&lt;br /&gt;
set root='(md/0)'  &lt;br /&gt;
linux /boot/vmlinuz-2.6.32-5-amd64 root=/dev/md0 ro quiet&lt;br /&gt;
&lt;br /&gt;
Once the system is up, you can check that the root partition is indeed using the RAID array by running mount and looking for something like:&lt;br /&gt;
&lt;br /&gt;
/dev/md0 on / type ext4 (rw,noatime,errors=remount-ro)&lt;br /&gt;
&lt;br /&gt;
6- Wipe the original drive by adding it to the RAID array&lt;br /&gt;
&lt;br /&gt;
Once you have verified that everything is working on /dev/sdb, it's time to change the partition types on /dev/sda to fd and to add the original drive to the degraded RAID array:&lt;br /&gt;
&lt;br /&gt;
mdadm /dev/md0 -a /dev/sda1  &lt;br /&gt;
mdadm /dev/md1 -a /dev/sda2&lt;br /&gt;
&lt;br /&gt;
You'll have to wait until the two partitions are fully synchronized but you can check the sync status using:&lt;br /&gt;
&lt;br /&gt;
watch -n1 cat /proc/mdstat&lt;br /&gt;
&lt;br /&gt;
7- Test booting off of the original drive&lt;br /&gt;
&lt;br /&gt;
Once the sync is finished, update the boot loader menu:&lt;br /&gt;
&lt;br /&gt;
update-grub&lt;br /&gt;
&lt;br /&gt;
and shut the system down:&lt;br /&gt;
&lt;br /&gt;
shutdown -h now&lt;br /&gt;
&lt;br /&gt;
before physically disconnecting /dev/sdb and turning the machine back on to test booting with only /dev/sda present.&lt;br /&gt;
&lt;br /&gt;
After a successful boot, shut the machine down and plug the second drive back in before powering it up again.&lt;br /&gt;
8- Resync drives&lt;br /&gt;
&lt;br /&gt;
If everything works, you should see the following after running cat /proc/mdstat:&lt;br /&gt;
&lt;br /&gt;
md0 : active raid1 sda1[1]  &lt;br /&gt;
280567040 blocks [2/1] [_U]&lt;br /&gt;
&lt;br /&gt;
indicating that the RAID array is incomplete and that the second drive is not part of it.&lt;br /&gt;
&lt;br /&gt;
To add the second drive back in and start the sync again:&lt;br /&gt;
&lt;br /&gt;
mdadm /dev/md0 -a /dev/sdb1&lt;br /&gt;
&lt;br /&gt;
9- Test booting off of the new drive&lt;br /&gt;
&lt;br /&gt;
To complete the testing, shut the machine down, pull /dev/sda out and try booting with /dev/sdb only.&lt;br /&gt;
10- Reboot with the two drives and resync the array&lt;br /&gt;
&lt;br /&gt;
Once you are satisfied that it works, reboot with both drives plugged in and re-add the first drive to the array:&lt;br /&gt;
&lt;br /&gt;
mdadm /dev/md0 -a /dev/sda1&lt;br /&gt;
&lt;br /&gt;
Your setup is now complete and fully tested.&lt;br /&gt;
Ongoing maintenance&lt;br /&gt;
&lt;br /&gt;
I recommend making sure the two RAIDed drives stay in sync by enabling periodic RAID checks. The easiest way is to enable the checks that are built into the Debian package:&lt;br /&gt;
&lt;br /&gt;
dpkg-reconfigure mdadm&lt;br /&gt;
&lt;br /&gt;
but you can also create a weekly or monthly cronjob which does the following:&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;check&amp;quot; &amp;gt; /sys/block/md0/md/sync_action&lt;br /&gt;
&lt;br /&gt;
Something else you should seriously consider is to install the smartmontools package and run weekly SMART checks by putting something like this in your /etc/smartd.conf:&lt;br /&gt;
&lt;br /&gt;
/dev/sda -a -d ata -o on -S on -s (S/../.././02|L/../../6/03)  &lt;br /&gt;
/dev/sdb -a -d ata -o on -S on -s (S/../.././02|L/../../6/03)&lt;br /&gt;
&lt;br /&gt;
These checks, performed by the hard disk controllers directly, could warn you of imminent failures ahead of time. Personally, when I start seeing errors in the SMART log (smartctl -a /dev/sda), I order a new drive straight away.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[Category:Ubuntu]]&lt;/div&gt;</summary>
		<author><name>Chubbard</name></author>
	</entry>
</feed>