{"id":1051,"date":"2021-02-19T12:20:44","date_gmt":"2021-02-19T12:20:44","guid":{"rendered":"http:\/\/www.tech-g.com\/?p=1051"},"modified":"2022-12-26T13:18:25","modified_gmt":"2022-12-26T13:18:25","slug":"mounting-a-disk-image-in-linux","status":"publish","type":"post","link":"https:\/\/www.voodoo.business\/blog\/2021\/02\/19\/mounting-a-disk-image-in-linux\/","title":{"rendered":"Mounting a disk image in Linux"},"content":{"rendered":"\n<p>The new way of mounting a disk image created with dd, dd_rescue, or ddrescue has become much simpler than before, all you need now is to issue the command<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">losetup --partscan --find --show disk.img<\/pre>\n\n\n\n<p>then above will tell you what loop device is being used, let us assume it is \/dev\/loop0, right after, a quick fdisk -l should show you the partitions, in my case, i have \/dev\/loop0p1 and \/dev\/loop0p2<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mount \/dev\/loop0p1 \/mnt<\/pre>\n\n\n\n<p>now, the first partition is mounted, to reverse this, you will need to first unmount \/mnt then, you can delete the loop device with <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">losetup -d \/dev\/loop0<\/pre>\n\n\n\n<p>At this stage you can mount it like any other device, in read-write mode by default, if you want to mount it in read only mode, you can use the -o switch<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo mount -o ro \/dev\/loop0px \/hds\/loopdevice<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>Now, if you have DDd a partition rather than a block device (disk) and want to mount it, you can simply mount it as a loop device, and then mount the loop device (loop0) without a Px at the end<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The new way of mounting a disk image created with dd, dd_rescue, or ddrescue has become much simpler than before, all you need now is to issue the command losetup &#8211;partscan &#8211;find &#8211;show disk.img then above will tell you what loop device is being used, let us assume it is \/dev\/loop0, right after, a quick [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,156],"tags":[],"class_list":["post-1051","post","type-post","status-publish","format-standard","hentry","category-linux","category-storage"],"_links":{"self":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/1051","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/comments?post=1051"}],"version-history":[{"count":4,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/1051\/revisions"}],"predecessor-version":[{"id":1891,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/1051\/revisions\/1891"}],"wp:attachment":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/media?parent=1051"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/categories?post=1051"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/tags?post=1051"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}