Sha256: 2f081848e0be4ec856f87e82f34c4345eedd3b29717fb14f478857f598aa10af
Contents?: true
Size: 561 Bytes
Versions: 3
Compression:
Stored size: 561 Bytes
Contents
#!/usr/bin/ruby # Demonstration of the creation of an lvm snapshot, using sudo, and reading its # attributes. $: << __dir__ + "/../lib" require "lvm" vol = "sys.vg/tmp.lv" snap = "demo_snap" lvm = LVM::LVM.new(command: "/usr/bin/sudo /sbin/lvm") if lvm.logical_volumes[snap] puts "#{snap} exists! Remove it" exit(1) end lvm.raw("lvcreate --snapshot --size 10M --name #{snap} #{vol}") lv = lvm.logical_volumes[snap] out = <<MSG snapshot of #{vol}, #{snap}, created - uuid: #{lv.uuid} - major,minor: #{lv.kernel_major},#{lv.kernel_minor} MSG puts out
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
chef-ruby-lvm-0.4.3 | examples/create_snapshot.rb |
chef-ruby-lvm-0.4.2 | examples/create_snapshot.rb |
chef-ruby-lvm-0.4.1 | examples/create_snapshot.rb |