class Getch::FileSystem::Lvm::Partition

Public Class Methods

new() click to toggle source
Calls superclass method Getch::FileSystem::Lvm::Device::new
# File lib/getch/filesystem/lvm/partition.rb, line 5
def initialize
  super
  @state = Getch::States.new()
  @partition = Getch::FileSystem::Partition.new
  @clean = Getch::FileSystem::Clean
  run_partition
end

Public Instance Methods

run_partition() click to toggle source
# File lib/getch/filesystem/lvm/partition.rb, line 13
def run_partition
  return if STATES[:partition ]
  @clean.old_vg(@dev_root, @vg)
  @clean.hdd(@disk)
  @clean.external_disk(@disk, @boot_disk, @cache_disk, @home_disk)
  partition
  lvm
  @state.partition
end

Private Instance Methods

exec(cmd) click to toggle source

Partition_bios None - Bios Boot Partition - 1MiB /boot - Boot - 8300 / - Root

# File lib/getch/filesystem/lvm/partition.rb, line 63
def exec(cmd)
  Getch::Command.new(cmd).run!
end
lvm() click to toggle source
# File lib/getch/filesystem/lvm/partition.rb, line 36
def lvm
  mem=`awk '/MemTotal/ {print $2}' /proc/meminfo`.chomp + 'K'
  exec("pvcreate -f #{@dev_root}")
  exec("vgcreate -f #{@vg} #{@dev_root}")
  # Wipe old signature: https://github.com/chef-cookbooks/lvm/issues/45
  exec("lvcreate -y -Wy -Zy -L #{mem} -n swap #{@vg}")

  if @user
    exec("lvcreate -y -Wy -Zy -L 18G -n root #{@vg}")
    exec("lvcreate -y -Wy -Zy -l 100%FREE -n home #{@vg}")
  else
    exec("lvcreate -y -Wy -Zy -l 100%FREE -n root #{@vg}")
  end

  exec("vgchange --available y")
end
partition() click to toggle source
# File lib/getch/filesystem/lvm/partition.rb, line 25
def partition
  if Helpers::efi?
    @partition.efi(@dev_esp)
    @partition.root(@dev_root, "8e00")
  else
    @partition.gpt(@dev_gpt)
    @partition.boot(@dev_boot)
    @partition.root(@dev_root, "8e00")
  end
end