0
votes

I need to setup an Ubuntu AWS EC2 instance to use the local SSD volumes (e.g. like the ones on the i3 instances). The local SSDs are much faster than EBS volumes, which also became pretty expensive when you need a lot of disk space (>10TB) and IOPS.

As the local volumes are volatile (they don't survive instance stop/start), I am considering options to back up the data.

I tried creating a raid0 device with the 2 local SSD volumes and then use lvm to create a mirrored lv using the raid device and an EBS volume (st1 - much slower but cheaper than io1). The mirrored lv should survive even if the raid device is gone.

The issue is that the speed of the resulting lvm device is similar to the EBS volume, not to the raid device.

sudo mdadm --create --verbose /dev/md0 --level=0 --name=local-ssd-raid --raid-devices=2 /dev/nvme0n1 /dev/nvme1n1
sudo pvcreate /dev/md0
sudo pvcreate /dev/xvdf
sudo vgcreate mixedvg /dev/md0 /dev/xvdf
sudo lvcreate -n data -l 100%FREE -m1 mixedvg /dev/md0 /dev/xvdf
sudo hdparm -tT /dev/mapper/mixedvg-data

/dev/mapper/mixedvg-data:
 Timing cached reads:   18336 MB in  1.99 seconds = 9217.77 MB/sec
 Timing buffered disk reads: 936 MB in  3.00 seconds = 311.52 MB/sec

Is there a way to specify which physical volume should lvm use as "primary"? I would like to specify the raid device as primary. The slower EBS volume could be updated at a slower rate.

Do you have other experiences backing up such data to EBS in an automated way?

Thanks!

1
If you create a RAID1 mirror, both of the devices (the LV and the EBS) need to be in-sync. ie literally a mirror image. Which is exactly what you are now experiencing. there is no option within RAID1 to work in primary/secondary mode, unless you break the mirror. - Marcel Dumont

1 Answers

0
votes

You can check the following article that demonstrates how to use the --write-mostly option https://n2ws.com/blog/how-to-guides/ephemeral-storage-on-ebs-volume