Skip to content

Instantly share code, notes, and snippets.

@d4l3k
Created July 7, 2020 03:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d4l3k/1ff8ca34bbacc639b15c5e62aff3d47b to your computer and use it in GitHub Desktop.
Save d4l3k/1ff8ca34bbacc639b15c5e62aff3d47b to your computer and use it in GitHub Desktop.

Mounting LVM partition from disk image

$ sudo losetup /dev/loop0 ./MTFC64GJVDN-4M_1BIT@LFBGA169_3731.BIN
$ sudo partx --update /dev/loop0
$ sudo lvmdiskscan
  /dev/nvme0n1         [    <476.94 GiB]
  /dev/loop0           [      59.28 GiB]
  /dev/mapper/cryptlvm [    <237.13 GiB] LVM physical volume
  /dev/nvme0n1p1       [     100.00 MiB]
  /dev/nvme0n1p2       [      16.00 MiB]
  /dev/nvme0n1p3       [    <238.23 GiB]
  /dev/nvme0n1p4       [     477.00 MiB]
  /dev/nvme0n1p5       [    <237.13 GiB]
  /dev/nvme0n1p6       [     200.00 MiB]
  /dev/loop0p1         [     127.75 MiB]
  /dev/loop0p2         [      <1.88 GiB]
  /dev/loop0p3         [      <1.88 GiB]
  /dev/loop0p4         [     <55.41 GiB] LVM physical volume
  0 disks
  11 partitions
  1 LVM physical volume whole disk
  1 LVM physical volume
$ sudo vgscan --mknodes --cache
  Reading volume groups from cache.
  Found volume group "ivg" using metadata type lvm2
  Found volume group "main" using metadata type lvm2
$ sudo lvscan
  inactive          '/dev/ivg/var' [256.00 MiB] inherit
  inactive          '/dev/ivg/log' [1.00 GiB] inherit
  inactive          '/dev/ivg/home' [7.00 GiB] inherit
  inactive          '/dev/ivg/amap' [8.00 GiB] inherit
  inactive          '/dev/ivg/bmap' [8.00 GiB] inherit
  inactive          '/dev/ivg/var.luks' [16.00 MiB] inherit
  inactive          '/dev/ivg/log.luks' [16.00 MiB] inherit
  inactive          '/dev/ivg/home.luks' [16.00 MiB] inherit
  inactive          '/dev/ivg/amap.luks' [16.00 MiB] inherit
  inactive          '/dev/ivg/bmap.luks' [16.00 MiB] inherit
  inactive          '/dev/ivg/gamesusr' [10.00 GiB] inherit
  inactive          '/dev/ivg/gamesusr.luks' [16.00 MiB] inherit
  inactive          '/dev/ivg/gamesvar' [1.00 GiB] inherit
  inactive          '/dev/ivg/gamesvar.luks' [16.00 MiB] inherit
  ACTIVE            '/dev/main/root' [237.12 GiB] inherit
$ sudo lvchange -ay ivg
$ sudo lvscan
  ACTIVE            '/dev/ivg/var' [256.00 MiB] inherit
  ACTIVE            '/dev/ivg/log' [1.00 GiB] inherit
  ACTIVE            '/dev/ivg/home' [7.00 GiB] inherit
  ACTIVE            '/dev/ivg/amap' [8.00 GiB] inherit
  ACTIVE            '/dev/ivg/bmap' [8.00 GiB] inherit
  ACTIVE            '/dev/ivg/var.luks' [16.00 MiB] inherit
  ACTIVE            '/dev/ivg/log.luks' [16.00 MiB] inherit
  ACTIVE            '/dev/ivg/home.luks' [16.00 MiB] inherit
  ACTIVE            '/dev/ivg/amap.luks' [16.00 MiB] inherit
  ACTIVE            '/dev/ivg/bmap.luks' [16.00 MiB] inherit
  ACTIVE            '/dev/ivg/gamesusr' [10.00 GiB] inherit
  ACTIVE            '/dev/ivg/gamesusr.luks' [16.00 MiB] inherit
  ACTIVE            '/dev/ivg/gamesvar' [1.00 GiB] inherit
  ACTIVE            '/dev/ivg/gamesvar.luks' [16.00 MiB] inherit
  ACTIVE            '/dev/main/root' [237.12 GiB] inherit
$ sudo mount /dev/ivg/home flash/
$ ls flash/
audiod/       ecallclient/       lost+found/   odin/      tesla/
cid-updater/  gpsmanager/        mediaserver/  qtaudiod/  tesla-cef/
connmetrics/  hermes-eventlogs/  monitord/     spotify/   tuner/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment