Results 1 to 10 of 14

Thread: [SOLVED] How to mount encrypted, LVM volumes?

Threaded View

  1. #1
    Join Date
    Dec 2007
    Location
    California
    Beans
    4,900
    Distro
    Ubuntu 13.04 Raring Ringtail

    [SOLVED] How to mount encrypted, LVM volumes?

    EDITED to reflect wanchai's comments and additions

    Dealing with encryption and LVM from a live cd.

    This is more for future refrence, I know I will have to deal with these disks from a live cd sometime. I currently have an encrypted file system that uses lvm. I have no idea how to work with these partitions! Right now I'm booted into a live cd, the file system was encrypted via luks (alternate install cd) I'm using twofish encryption.

    Okay this was easier than I thought it was going to be, man pages are great.

    /dev/sda1 is my /boot
    /dev/sda2 is my crypto partition
    Code:
    sudo apt-get install cryptsetup            # Installs the tools we need to deal with encrypted partitions
    sudo modprobe dm-crypt                      # Inserts a module we need
    sudo cryptsetup luksOpen /dev/sda2 cheer   # Unlocks the partition sda2 and names it cheer
    Enter LUKS passphrase: 
    key slot 0 unlocked.
    Command successful.
    #
    # Now that we have unlocked the encryption, it's just dealing with the lvm
    #
    #
    sudo apt-get install lvm2  # installs the tools we need
    sudo modprobe dm-mod       # inserts a module we need
    sudo vgscan                # Scans for all volume groups
      Reading all physical volumes.  This may take a while...
      Found volume group "Ubuntu" using metadata type lvm2
    sudo vgchange -a y Ubuntu  # this made the VG Ubuntu active, if you don't give it a volume group as an argument it'll make them all active        
    sudo lvscan                # This command lists the logical volumes and their /dev path
      ACTIVE            '/dev/Ubuntu/Root' [15.00 GB] inherit
      ACTIVE            '/dev/Ubuntu/swap' [1.00 GB] inherit
      ACTIVE            '/dev/Ubuntu/home' [215.89 GB] inherit
    #
    # Now I mount them to do whatever it is I need to do, if you wanted to run a fsck on them you obviously wouldn't mount them.
    #
    sudo mkdir /media/root; sudo mkdir /media/home
    sudo mount /dev/Ubuntu/Root /media/root; sudo mount /dev/Ubuntu/home /media/home
    #
    # Now to reverse the process and unmount everything
    #
    sudo umount /media/root; sudo umount /media/home
    sudo rmdir /media/root; sudo rmdir /media/home
    sudo vgchange -a n Ubuntu 
    sudo cryptsetup luksClose cheer
    Last edited by jerome1232; January 9th, 2009 at 08:46 PM.
    "You can't expect to hold supreme executive power just because some watery tart lobbed a sword at you"

    "Don't let your mind wander -- it's too little to be let out alone."

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •