I have Ubuntu server with 1x2TB HDD and 1x128GB SSD (unused). There are 2 partitions: /boot, and a physical volume for LVM, which has 1 group and 5 logical volumes: /, /var/log, /home, /srv, /tmp.
Recently the 2nd 2TB HDD arrived. We need better redundancy, so I'm looking at either joining 2 HDDs into 1 RAID1 (with /boot, /, and an LVM partition with /home, /var/log, /srv, /tmp), or adding 2nd HDD as LVM physical volume, and using LVM mirroring for logical partitions.
In addition to redundancy, I need to achieve 2 more goals: - relatively safe change from 1xHDD to 2xHDDs (I'm administering remotely a live system) - easy future extensions of LVM partitions.
Here, is RAID1 superior to LVM mirroring? (I believe it is. I'm talking software RAID1 here.)
If it is - what would be the best way to convert a 1xHDD live system to a 1xRAID1 live system remotely, if all I have is an empty 128GB SSD, and all HDD data currently fits onto it easily?
assuming sda is the original disk, and sdb is the new disk:
c
so it is aligned, and change the partition type toda
.sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 missing
to create the raid device from the newly partitioned drive.sudo mdadm -Es
and copy the output of this to/etc/mdadm/mdadm.conf
so the raid device gets started automatically when the server reboots.sudo pvcreate /dev/md0
, after this just do vgcreate on /dev/md0 and lvcreate like usual, or you can use pvmoveAfter the data is moved off the old drive and on to the new, you can repartition the old drive, making sure the partition size is the same as the new raid drive. Then add it to the raid device with:
sudo mdadm --manage --add /dev/md0 /dev/sda1
. Since it sounds like these are boot drives, you'll want to install grub to both drives.Since this is a remote system, you'll probably want to do
sudo dpkg-reconfigure mdadm
(assuming this is a debian-based system, such as Ubuntu) and enable boot with degraded raid.You'll also want to set up email so mdadm can notify you of issues with the Raid device (such as a failed drive).
sudo aptitude install postfix
/etc/aliases
and addroot: yourusername
so root's mail go to you~/.forward
with[email protected]
so your emails go to your email accountI was advised that possibly the easiest way to convert 1xHDD into 1xRAID1 is by:
Relevant links: 1, 2.