Well today I had to reinstall Mint on one of my computers, both of which have RAID-1 arrays. This time I installed Mint 18 onto the DB75EN. And of course I wanted to pick up my existing RAID array without having to build it from scratch. Initially I was going to build a test system to see if I could pick up the existing array, before doing it live, but it was easier just to back up all the data and go straight onto trying it on the live system. I used the previous posts I have written as guides because it was nearly all the same, but the steps are outlined in full below.
It goes without saying that the first thing you should do before reinstalling is, of course, to back up your existing data, which in this case is the contents of /home, which is the mount point of that RAID array in my case, as I am using a separate SSD as /. I am continuing with that setup, and therefore the structure of the disk and array is essentially unchanged.
There are lots of different ways of setting up RAID when reinstalling. Mint doesn’t have the alternate installer that Ubuntu has that will enable the RAID to be setup during install. Setting up the RAID during install is particularly essential if you want to boot off it. Since boot RAID is not particularly critical on an average PC or server, using a separate non-RAID disk for the operating system and swap is what I have done on my RAID-equipped PCs and servers for quite a while. In my case I have chosen to install Mint like normal, and recover the RAID array after completing the install.
So my starting point is that the home drive will be in the SSD by default and I have to install mdadm and then assemble the array (rather than creating it), then change the mount point for /home to point to it, and everything should be sweet. As it turned out the assemble worked flawlessly and this is how you pick up an existing RAID array from a previous install. If /home is mounted onto your RAID array then setting it up is one of the very first steps you should do after installing Mint, before you configure anything or install any software, because you don’t want stuff getting put into the current location of /home and then getting lost when you move it to the RAID-1 array.
Steps taken are as follows (precede these with sudo as necessary)
Install mdadm:
Tell mdadm to find the existing array:
See if mdadm has stored the array information in its conf file:
- gedit /etc/mdadm/mdadm.conf
At this point I can see the details of my array in the configuration file so it looks like mdadm has located it. My next step is to open the Disks tool, find the array and mount it, which for now is in the /media path.
Now we have to look at what is needed for startup and that is the modules, so we use gedit to add the necessary lines in /etc/modules:
raid1 is required – (md might be required if it exists in your system)
raid1 is already loaded in memory, this step just makes sure it will load at boot time next time you restart the system.I chose to restart at this point to check everything would work OK, which it did.
Next, we have a look in mdadm’s conf file to see if it has the details of our existing array in there:
- cat /etc/mdadm/mdadm.conf
And yes it does have it there. So this is all that is needed to get the RAID array going when the computer is started up.
Our final steps are what is needed to relocate /home back onto the RAID array and get it to mount automatically at startup. First of all we need to get the UUID of the partition on the RAID array. We use the following command to do this:
This is giving me the UUID for /dev/md0 in this case and now I need to edit /etc/fstab to put this in to the mounting, I use gedit for this.
and my line will look something like
UUID=581966fb-0d41-4dac-bef3-c6de6267ec9e /home ext4 defaults 0 2
Now I have to get rid of the existing home in / and make it OK for the new one.
- mv /home /oldhome
- mkdir /home
- mount -a
simply moves the existing home directory to another location on the boot volume and then creates a new blank home directory to be used as the mount point for my RAID array. The mount command will then mount the RAID volume to /home by reading fstab.
This all checked out OK so now everything is back to where it was for the home drive on the RAID array. Since my home drive wasn’t wiped, then when I start up Thunderbird for example, it will pick up all of my existing configurations and email and doesn’t require me to set it up again. This is even better than separating partitions on Windows because
- Windows doesn’t officially support separate partitions for User folders, and quite often it won’t update to a new version if you have this hack (set in the registry) in place.
- You can’t simply use a previous user profile because Windows will get all upset and create a new blank one. Therefore for practical reasons it is easier to backup the existing user profile. But then the registry is wiped and not only do you have to reinstall each application, but you also have to install their settings. With Mint, you only have to reinstall the applications; because it doesn’t use a central registry, configuration data is stored in the user’s home folder, and it can pick that data up right where it left off, in most cases.
So that completes reinstalling Mint with a RAID array. Only one computer has Mint 18 so far. There is an issue with 18 that causes problems with Google Earth so the map making computer is not getting an upgrade just yet. That computer will, however, soon have 24 GB of RAM installed to make it faster with all the map editing stuff running on it as well as a virtual machine running Windows at the same time.
One of the objectives for reinstalling was to get hibernation working again after having it stop working after I had changed the video card when I swapped cards with the H97-D3H. There was probably some other complex process I could have followed but since there is a new version of Mint out and since it is so much quicker to reinstall compared to Windows then that was the solution I chose, and hibernation is working again. The flipside of faster reinstallation of the OS and software compared to Windows is having to do stuff like reconnect software RAID arrays. Although you have to do this on Windows as well, which generally involves running the Computer Management administrative tool and then opening Disk Management and then generally importing a foreign RAID array, it is all in a GUI.
DEBIAN NOTE: When I install Debian it usually installs mdadm during the installation so it can present the RAID array in the partitioner. This means a lot of the above steps are unnecessary. All I normally have to do with Debian are put the raid1 module into /etc/modules, and set up the mount in /etc/fstab and move the old home directory.