在第二个驱动器上安装和访问加密的LVM

在一台机器上,我在/dev/sda上的LVM周围有一个加密的LUKS容器,我可以启动它。 在同一台机器上是第二个驱动器,在/dev/sdb上的LVM周围有一个加密的LUKS容器(GRUB目前看不到)。

理想情况下,我想在Nautilus中看到/dev/sdb的内容,所以我可以复制一些文件。

在启动到/dev/sda使用Nautilus,如何在/dev/sdb上访问加密LVM内的//home

引文

 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 -ay 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 -an Ubuntu sudo cryptsetup luksClose cheer 

如果两个LVM具有相同的名称,则可以更改名称:

 sudo vgdisplay sudo vgrename oldUUID newName