為我的USB掛載dd映像


3

我正在嘗試掛載.dd映像。我遵循了2種方法,但均未成功...

方法1

第一步:

[email protected]:/root# blkid qassam.dd
qassam.dd: UUID="524F4B6665E82B4E" TYPE="ntfs"

第二步:

我運行了此命令以將圖像附加到循環設備

sudo losetup -f -P qassam.dd

第三步:

然後我運行此命令以驗證是否檢測到映像並檢測到分區:

losetup -l

command output

第四步:

當我嘗試通過此命令mount /dev/loop10 q/掛載映像時,出現此錯誤:

ntfs_mst_post_read_fixup_warn: magic: 0x00000000  size: 4096   usa_ofs: 0  usa_count: 0: Invalid argument
Actual VCN (0x0) of index buffer is different from expected VCN (0x3).
Failed to open $Secure: No such file or directory
Failed to mount '/dev/loop10': No such file or directory

方法2

我使用了kpartx -a -v qassam.dd,但出現此錯誤:

device-mapper: resume ioctl on loop9p1 failed: Invalid argument create/reload failed on loop9p1
device-mapper: resume ioctl on loop9p2 failed: Invalid argument create/reload failed on loop9p2
device-mapper: resume ioctl on loop9p3 failed: Invalid argument create/reload failed on loop9p3
device-mapper: resume ioctl on loop9p4 failed: Invalid argument create/reload failed on loop9p4
3

The OP never told us any details about their file qassam.dd, so we can only guess why they failed to mount it.

  • Maybe they forgot elevated permissions, sudo for the mount command.
  • Maybe the file system in the image file was corrupted.
  • Maybe it should have been loop mounted directly (not via losetup).
  • Maybe the partition table was GPT.
  • Maybe the mount command line was wrong, the OP should have looked for the device map of the partition, and used /dev/loop10p1 or /dev/mapper/loop10p1 not /dev/loop10 in the mount command.

Image file of a partition with NTFS

An image of a partition should be possible to loop mount directly, and I tested it like this,

sudo mount -o loop ntfs.img /mnt/sd1

$ echo "Hello World" > /mnt/sd1/hello.txt
$ ls -l /mnt/sd1
totalt 1
-rwxrwxrwx 1 root root 12 dec 15 23:10 hello.txt
$ cat /mnt/sd1/hello.txt
Hello World


$ losetup -l
NAME  SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE                                DIO LOG-SEC
/dev/loop0    0      0         1  0 /media/multimed-2/test/test0/temp/ntfs.img 0     512

sudo mount /dev/loop0 /mnt/lp1

$ sudo lsblk -fm /dev/loop0
NAME  FSTYPE LABEL UUID                          MOUNTPOINT SIZE OWNER GROUP MODE
loop0 ntfs         3B1CD6465B1E284E              /mnt/sd1     4G root  disk  brw-rw----

Image files of drives with partition tables

With MSDOS partition tables it was possible to mount and see the file systems via the first method of the question,

sudo losetup -f -P filename.img

list the result with

losetup -l

and mount the file system(s) with

sudo mount /dev/loop0p1 /mnt/lp1
sudo mount /dev/loop0p2 /mnt/lp2
...

With a GUID partition table it was possible to see the file systems via the second method of the question (but the first method failed),

sudo kpartx -a -v -g filename.img

Testing with an available image file,

sudo kpartx -a -v -g Lubuntu_16.04.2_amd64_persist-live_mkusb-12.1.2_7.8GB_guid-pt.img

it did not work to mount the file system(s) with

sudo mount /dev/loop0p1 /mnt/lp3
sudo mount /dev/loop0p2 /mnt/lp4
...

The loop devices could be seen by lsblk but the loop devices were hidden in the mapper subdirectory, found via find

$ sudo find /dev/ -name "*loop0*"
/dev/disk/by-id/dm-name-loop0p5
/dev/disk/by-id/dm-name-loop0p4
/dev/disk/by-id/dm-name-loop0p3
/dev/disk/by-id/dm-name-loop0p2
/dev/disk/by-id/dm-name-loop0p1
/dev/mapper/loop0p5
/dev/mapper/loop0p4
/dev/mapper/loop0p3
/dev/mapper/loop0p2
/dev/mapper/loop0p1
/dev/loop0

It was possible to mount them, for example

sudo mount /dev/mapper/loop0p1 /mnt/lp1

$ sudo lsblk -fm /dev/loop0
NAME      FSTYPE  LABEL                     UUID                                 MOUNTPOINT  SIZE OWNER GROUP MODE
loop0                                                                                        7,3G root  disk  brw-rw----
├─loop0p1 ntfs    usbdata                   09BA4B4A391B6781                     /mnt/lp1    1,3G root  disk  brw-rw----
├─loop0p2                                                                                      1M root  disk  brw-rw----
├─loop0p3 vfat    usbboot                   8A41-08E7                                        122M root  disk  brw-rw----
├─loop0p4 iso9660 Lubuntu 16.04.2 LTS amd64 2017-02-15-20-52-49-00                           898M root  disk  brw-rw----
└─loop0p5 ext4    casper-rw                 5bb1ca94-c265-4317-8b87-39a5486b16b9               5G root  disk  brw-rw----

$ ls -l /mnt/lp1
totalt 12
-rwxrwxrwx 1 root root 3582 feb 25  2017 backup
-rwxrwxrwx 1 root root 4592 feb 25  2017 restore

Output during testing some available img files with MSDOS partition table:

$ losetup -l
NAME       SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE                                                                                                                   DIO LOG-SEC
/dev/loop1         0      0         0  0 /media/multimed-2/test/torios/persist/grub-n-iso/dd_ToriOS-persistent.img                                                     0     512
/dev/loop2         0      0         0  0 /media/multimed-2/boot-usb/OneButtonInstaller/xz/dd_Lubuntu_18.04_i386_persist-live_15.7GB_casper-rw_home-rw_msdos.img        0     512
/dev/loop0         0      0         0  0 /media/multimed-2/boot-usb/OneButtonInstaller/xz/dd_Lubuntu_16.04.1-persist-live-and-installed-mkusb-11.0.5_7.8GB-msdos.img   0     512

$ sudo lsblk -fm /dev/loop[0-2]
NAME      FSTYPE  LABEL                     UUID                                 MOUNTPOINT  SIZE OWNER GROUP MODE
loop0                                                                                       14,6G root  disk  brw-rw----
├─loop0p1 ntfs    usbdata                   35CF6A8A4AB6BF72                     /mnt/lp1    2,2G root  disk  brw-rw----
├─loop0p2                                                                                      1K root  disk  brw-rw----
├─loop0p3 vfat    usbboot                   2706-585F                            /mnt/lp2    122M root  disk  brw-rw----
├─loop0p4 iso9660 Lubuntu 16.04.1 LTS amd64 2016-07-20-12-16-02-00               /mnt/lp3    874M root  disk  brw-rw----
├─loop0p5 ext4    casper-rw                 e47ec6db-149d-4d30-98af-0419786ba250 /mnt/lp4    4,6G root  disk  brw-rw----
├─loop0p6 ext4    installed                 1acf7b6f-bb3b-4d18-90ec-454f8353c84f /mnt/lp5    5,9G root  disk  brw-rw----
└─loop0p7 swap    swap                      f2d7bd6e-eca9-48e8-a203-a1de2665d0e5            1023M root  disk  brw-rw----
loop1                                                                                        792M root  disk  brw-rw----
├─loop1p1 vfat    bootgrub                  C192-D34A                                         16M root  disk  brw-rw----
├─loop1p2 iso9660 torios-live               2015-06-14-16-48-49-00                           725M root  disk  brw-rw----
└─loop1p3 ext2    live-rw                   a9843e51-4141-408b-975b-52d89eca1b28              50M root  disk  brw-rw----
loop2                                                                                       14,6G root  disk  brw-rw----
├─loop2p1 vfat    lub1804-32                D4E5-7662                                         64M root  disk  brw-rw----
├─loop2p2 ext4    isodevice                 1b9f2fa2-1eab-49fa-be1c-57d38acb221f             2,2G root  disk  brw-rw----
├─loop2p3 ext4    casper-rw                 6c49bda6-68d5-44ea-9904-22b52aee2400               5G root  disk  brw-rw----
└─loop2p4 ext4    home-rw                   53476429-dc26-4395-b951-065b8c36060e             7,3G root  disk  brw-rw----