{"id":841,"date":"2019-03-22T21:55:47","date_gmt":"2019-03-23T02:55:47","guid":{"rendered":"http:\/\/sunapi386.ca\/wordpress\/?p=841"},"modified":"2019-03-22T21:55:55","modified_gmt":"2019-03-23T02:55:55","slug":"mount-locked-partition-with-same-volume-group-name","status":"publish","type":"post","link":"https:\/\/sunapi386.ca\/wordpress\/mount-locked-partition-with-same-volume-group-name\/","title":{"rendered":"Mount locked partition with same volume group name"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">Background\/Setup<\/h1>\n\n\n\n<ul class=\"wp-block-list\"><li>I have two physical 1TB disks with identical setup.<\/li><li>Both are encrypted.<\/li><li>I unlocked and booted off one of them.<\/li><li>The other disk is still locked at this point.<\/li><li>I am using fish shell.<\/li><\/ul>\n\n\n\n<h1 class=\"wp-block-heading\"><a href=\"https:\/\/gist.github.com\/sunapi386\/4e4554a2da4cff75b07d1890e2ec0920#1-identify-which-disk-you-want-to-unlock\"><\/a>1. Identify which disk you want to unlock<\/h1>\n\n\n\n<pre class=\"wp-block-preformatted\">root@computer ~# lsblk -f\nsda                                                                                                    \n\u251c\u2500sda1                                        vfat              7F3B-9703                              \/boot\/efi\n\u251c\u2500sda2                                        ext2              b6220db2-916c-4322-b64b-c86769f6b18b   \/boot\n\u2514\u2500sda3                                        crypto_LUKS       3a07b8a9-3e75-41a9-88d4-3be937181613   \n  \u2514\u2500luks-3a07b8a9-3e75-41a9-88d4-3be937181613 LVM2_member       uCvHaW-RlQc-PT2d-cBg2-SWyY-WS0A-ZCEvA6 \n    \u251c\u2500ubuntu--vg-root                         ext4              a78662e2-d582-4faa-88b6-b6db5e23aed2   \/\n    \u2514\u2500ubuntu--vg-swap_1                       swap              5c4ba6cc-4735-4417-9e87-74a76a7fc415   [SWAP]\nsdb                                                                                                    \n\u251c\u2500sdb1                                        vfat              1EC8-1F58                              \n\u251c\u2500sdb2                                        ext2              7108fe1d-dc37-4213-a3bc-8070a8f84f31   \/media\/jsun\/7108fe1d-dc37-4213-a3bc-8070a8f84f31\n\u2514\u2500sdb3                                        crypto_LUKS       fc560468-588c-4455-af2c-295998c41c88   <\/pre>\n\n\n\n<p>We see that&nbsp;<code>sdb3<\/code>&nbsp;is the unmounted target.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><a href=\"https:\/\/gist.github.com\/sunapi386\/4e4554a2da4cff75b07d1890e2ec0920#2-unlock-the-partition\"><\/a>2. Unlock the partition<\/h1>\n\n\n\n<pre class=\"wp-block-preformatted\">root@computer ~# udisksctl unlock -b \/dev\/sdb3 <br>Passphrase:  <br>Unlocked \/dev\/sdb3 as \/dev\/dm-3.<br><br><\/pre>\n\n\n\n<p>See which one is the new unlocked<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@computer ~# ls -la \/dev\/mapper\/ | grep dm-3 <br>lrwxrwxrwx  1 root root       7 Mar 22 17:32 luks-fc560468-588c-4455-af2c-295998c41c88 -> ..\/dm-3 <\/pre>\n\n\n\n<p><code>luks-fc560468-588c-4455-af2c-295998c41c88<\/code>&nbsp;is our target. Let&#8217;s remember that with a variable.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">set target luks-fc560468-588c-4455-af2c-295998c41c88<\/pre>\n\n\n\n<h1 class=\"wp-block-heading\"><a href=\"https:\/\/gist.github.com\/sunapi386\/4e4554a2da4cff75b07d1890e2ec0920#3\"><\/a>3.<\/h1>\n\n\n\n<p>The&nbsp;<code>VG Name<\/code>&nbsp;of both drives is the same; this is problematic and will prevent you from being able to mount the drives both at the same time.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@computer ~# pvdisplay<br>   --- Physical volume ---   <br>PV Name               \/dev\/mapper\/luks-3a07b8a9-3e75-41a9-88d4-3be937181613   <br>VG Name               ubuntu-vg   PV Size               930.53 GiB \/ not usable 2.00 MiB   <br>Allocatable           yes (but full)   <br>PE Size               4.00 MiB   <br>Total PE              238216   <br>Free PE               0   <br>Allocated PE          238216   <br>PV UUID               uCvHaW-RlQc-PT2d-cBg2-SWyY-WS0A-ZCEvA6<br>       --- Physical volume ---   <br>PV Name               \/dev\/mapper\/luks-fc560468-588c-4455-af2c-295998c41c88   <br>VG Name               ubuntu-vg   <br>PV Size               930.53 GiB \/ not usable 2.00 MiB   <br>Allocatable           yes (but full)   <br>PE Size               4.00 MiB   <br>Total PE              238216   <br>Free PE               0   <br>Allocated PE          238216   <br>PV UUID               lbvecI-E6w6-fpuj-P61G-5NCb-obOK-ooivpe<\/pre>\n\n\n\n<h1 class=\"wp-block-heading\"><a href=\"https:\/\/gist.github.com\/sunapi386\/4e4554a2da4cff75b07d1890e2ec0920#get-the-uuid-of-the-volume\"><\/a>Get the uuid of the volume<\/h1>\n\n\n\n<pre class=\"wp-block-preformatted\">root@computer ~# uuidgen<br> 1ec80451-b05b-4d59-94c1-f1ad70b24255<br> root@computer ~# vgrename $uuid 1ec80451-b05b-4d59-94c1-f1ad70b24255<br>   Processing VG ubuntu-vg because of matching UUID TJgeFw-xDcf-TaJ2-07dL-RlUQ-yCsb-zGGp4v<br>   Volume group \"TJgeFw-xDcf-TaJ2-07dL-RlUQ-yCsb-zGGp4v\" successfully renamed to \"1ec80451-b05b-4d59-94c1-f1ad70b24255\"<br> root@computer ~# pvs -o +vg_uuid<br>   PV                                                    VG                                   Fmt  Attr PSize   PFree VG UUID                               <br>   \/dev\/mapper\/luks-3a07b8a9-3e75-41a9-88d4-3be937181613 ubuntu-vg                            lvm2 a--  930.53g    0  TAva2M-zNnV-Wh5h-3YcY-Vc5U-W4se-TI27Du<br>   \/dev\/mapper\/luks-fc560468-588c-4455-af2c-295998c41c88 1ec80451-b05b-4d59-94c1-f1ad70b24255 lvm2 a--  930.53g    0  TJgeFw-xDcf-TaJ2-07dL-RlUQ-yCsb-zGGp4v<\/pre>\n\n\n\n<p>The device UUID is&nbsp;<code>TJgeFw-xDcf-TaJ2-07dL-RlUQ-yCsb-zGGp4v<\/code>. Let&#8217;s remember that with a variable.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">set uuid TJgeFw-xDcf-TaJ2-07dL-RlUQ-yCsb-zGGp4v<\/pre>\n\n\n\n<h1 class=\"wp-block-heading\"><a href=\"https:\/\/gist.github.com\/sunapi386\/4e4554a2da4cff75b07d1890e2ec0920#change-the-volume-group\"><\/a>Change the volume group<\/h1>\n\n\n\n<p>I&#8217;m going to generate a UUID, but you can name whatever you want.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@computer ~# uuidgen<br> 1ec80451-b05b-4d59-94c1-f1ad70b24255<br> root@computer ~# vgrename $uuid 1ec80451-b05b-4d59-94c1-f1ad70b24255<br>   Processing VG ubuntu-vg because of matching UUID TJgeFw-xDcf-TaJ2-07dL-RlUQ-yCsb-zGGp4v<br>   Volume group \"TJgeFw-xDcf-TaJ2-07dL-RlUQ-yCsb-zGGp4v\" successfully renamed to \"1ec80451-b05b-4d59-94c1-f1ad70b24255\"<br> root@computer ~# pvs -o +vg_uuid<br>   PV                                                    VG                                   Fmt  Attr PSize   PFree VG UUID                               <br>   \/dev\/mapper\/luks-3a07b8a9-3e75-41a9-88d4-3be937181613 ubuntu-vg                            lvm2 a--  930.53g    0  TAva2M-zNnV-Wh5h-3YcY-Vc5U-W4se-TI27Du<br>   \/dev\/mapper\/luks-fc560468-588c-4455-af2c-295998c41c88 1ec80451-b05b-4d59-94c1-f1ad70b24255 lvm2 a--  930.53g    0  TJgeFw-xDcf-TaJ2-07dL-RlUQ-yCsb-zGGp4v<\/pre>\n\n\n\n<p>Check\/notice the new volume group name&nbsp;<code>1ec80451-b05b-4d59-94c1-f1ad70b24255<\/code>.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><a href=\"https:\/\/gist.github.com\/sunapi386\/4e4554a2da4cff75b07d1890e2ec0920#confirm-the-change\"><\/a>Confirm the change<\/h1>\n\n\n\n<pre class=\"wp-block-preformatted\">root@computer ~# vgchange -a y<br>   2 logical volume(s) in volume group \"ubuntu-vg\" now active<br>   2 logical volume(s) in volume group \"1ec80451-b05b-4d59-94c1-f1ad70b24255\" now active<\/pre>\n\n\n\n<p>Remember to rename your volume group back to&nbsp;<code>ubuntu-vg<\/code>&nbsp;if you want the volume to still be bootable.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><a href=\"https:\/\/gist.github.com\/sunapi386\/4e4554a2da4cff75b07d1890e2ec0920#mount\"><\/a>Mount<\/h1>\n\n\n\n<pre class=\"wp-block-preformatted\">root@computer ~# mkdir \/media\/badboy<br> root@computer ~# mount \/dev\/1ec80451-b05b-4d59-94c1-f1ad70b24255\/root \/media\/badboy<br> root@computer ~# cd \/media\/badboy\/<br> root@computer \/m\/badboy# ls<br> bin\/   cdrom\/  etc\/   initrd.img@      lib\/    lib64\/       media\/  opt\/   root\/  sbin\/  srv\/  tmp\/  var\/<br> boot\/  dev\/    home\/  initrd.img.old@  lib32\/  lost+found\/  mnt\/    proc\/  run\/   snap\/  sys\/  usr\/  vmlinuz@<\/pre>\n\n\n\n<p>You can now access your data.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Background\/Setup I have two physical 1TB disks with identical setup. Both are encrypted. I unlocked and booted off one of them. The other disk is still locked at this point. I am using fish shell. 1. Identify which disk you want to unlock root@computer ~# lsblk -f sda \u251c\u2500sda1 vfat 7F3B-9703 \/boot\/efi \u251c\u2500sda2 ext2 b6220db2-916c-4322-b64b-c86769f6b18b &hellip; <a href=\"https:\/\/sunapi386.ca\/wordpress\/mount-locked-partition-with-same-volume-group-name\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Mount locked partition with same volume group name<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[],"class_list":["post-841","post","type-post","status-publish","format-standard","hentry","category-thoughts"],"_links":{"self":[{"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/posts\/841","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/comments?post=841"}],"version-history":[{"count":1,"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/posts\/841\/revisions"}],"predecessor-version":[{"id":843,"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/posts\/841\/revisions\/843"}],"wp:attachment":[{"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/media?parent=841"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/categories?post=841"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sunapi386.ca\/wordpress\/wp-json\/wp\/v2\/tags?post=841"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}