Created
October 14, 2015 19:54
-
-
Save gousiosg/59db31511adcd80a155f to your computer and use it in GitHub Desktop.
Setting up SSD as a cache for slow cloud volumes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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