Skip to content

Instantly share code, notes, and snippets.

@jlxw
Created May 5, 2013 04:16
Show Gist options
  • Save jlxw/5519672 to your computer and use it in GitHub Desktop.
Save jlxw/5519672 to your computer and use it in GitHub Desktop.
Gives you commands to replicate the structure of LVM volumes on 1 machine on another.
#! /bin/env ruby
require 'pp'
`lvscan`.gsub(/[\[\]']/,'').split("\n").each do |device_line|
device_line = device_line.split
vg, lv = device_line[1].split('/')[-2,2]
puts "lvcreate -L #{device_line[2].to_f}#{device_line[3][0,1]} -n #{lv} #{vg}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment