Skip to content

Instantly share code, notes, and snippets.

@ezheidtmann
Last active October 12, 2015 15:27
Show Gist options
  • Save ezheidtmann/44d9a5f183b4edd29bc2 to your computer and use it in GitHub Desktop.
Save ezheidtmann/44d9a5f183b4edd29bc2 to your computer and use it in GitHub Desktop.
LVM2 cheat sheet
# LVM is an advanced system. This document only describes my use case.
# I use it on a pair of external USB disks; these commands help me to mount & unmount logical volumes on my laptop.
#####
# Plug in the disks, mount them
vgscan # maybe optional
vgchange -ay # creates /dev/* entries
mount /dev/<vgname>/<lvname> /mountpoint
#####
# How to remove disks
umount <volumes on disks>
vgchange -a n <vgname>
#####
# You unplugged your disks (oops). List devicemapper entries and prune the broken ones:
dmsetup ls
dmsetup remove <name>
# this is safe if you don't have any active lvm volumes
dmsetup remove_all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment