Skip to content

Instantly share code, notes, and snippets.

@tobert
Created March 25, 2014 03:05
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 tobert/9754543 to your computer and use it in GitHub Desktop.
Save tobert/9754543 to your computer and use it in GitHub Desktop.
Throw together a quick LVM config for dumping the device mapper table
#!/bin/bash
# create empty volume files
truncate --size 256M /a
truncate --size 256M /b
# attach them to loopback devices
deva=$(losetup --find)
losetup $deva /a
devb=$(losetup --find)
losetup $devb /b
# format as LVM physical volumes
pvcreate $deva
pvcreate $devb
# create the volume group
vgcreate test $deva $devb
# create a mirrored (RAID1) logical volume with an in-memory replication log
lvcreate --extents 1 --mirrors 1 --corelog --name lv_derp test
dmsetup table /dev/mapper/test-lv_derp
# 0 8192 mirror core 1 1024 2 253:0 0 253:1 0 1 handle_errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment