Skip to content

Instantly share code, notes, and snippets.

@gousiosg
Created October 14, 2015 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gousiosg/59db31511adcd80a155f to your computer and use it in GitHub Desktop.
Save gousiosg/59db31511adcd80a155f to your computer and use it in GitHub Desktop.
Setting up SSD as a cache for slow cloud volumes
#!/usr/bin/env bash
lsblk
apt-get install -y lvm2 mdadm bcache-tools
# Create a linux raid autodetect primary partition
# use the following keystrokes: np1tfdw
fdisk /dev/sdc
fdisk /dev/sdd
# setup raid
mdadm --create /dev/md127 --level 0 --raid-devices 2 /dev/sdc1 /dev/sdd1
# setup LVM: optional, you can replace /dev/vg0/lv0 with /dev/md127 below
pvcreate /dev/md127
vgcreate vg0 /dev/md127
lvcreate -l 90%FREE -n lv0 vg0
# This is the default SSD attached on DS2 VMs
umount /dev/sdb
# Zero out existing partitions
dd if=/dev/zero of=/dev/sdb bs=512 count=100
dd if=/dev/zero of=/dev/vg0/lv0 bs=512 count=100
# init bache
make-bcache -C /dev/sdb -B /dev/vg0/lv0
#create FS
mkfs -t ext4 /dev/bcache0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment