ralphje / imagemounter

Command line utility and Python package to ease the (un)mounting of forensic disk images
MIT License
118 stars 36 forks source link

Unmounting qcow2, vbox images is not working correctly #26

Closed ruzzle closed 2 years ago

ruzzle commented 6 years ago

When unmounting mounted .qcow2- or .vdi-images, the /dev/nbd# device fails to disconnect. This is caused by the ismount check in _util.clean_unmount:

elif not os.path.ismount(mountpoint):

Because the /dev/nbd# device does not actually show up in the mounts lists, the check returns True and the check_call is never reached, so the /dev/nbd# device stays (erroneously) intact.

An option might be to change the above line to:

elif not os.path.ismount(mountpoint) and cmd[0] != 'qemu-nbd':

ralphje commented 6 years ago

Thanks for the report. I'll need to test this case more closely to build a patch.

agibbons27 commented 3 years ago

I have also run into this issue and would like to have it fixed. I tested the solution mentioned above and it disconnects the /dev/nbd# devices properly.

elif not os.path.ismount(mountpoint) and cmd[0] != 'qemu-nbd':

ralphje commented 2 years ago

I have fixed this issue in e340fcf92583f9b333d088d71c8655094695363b