Results 1 to 3 of 3

Thread: Can you mount a hard disk image?

Hybrid View

  1. #1
    Join Date
    Nov 2007
    Location
    UK
    Beans
    288
    Distro
    Ubuntu 12.04 Precise Pangolin

    Can you mount a hard disk image?

    I was looking at a very pleasant guide to SSH piping here and part 3 got me thinking.

    If you had a dump of a hard disk partition (e.g. dd if=/dev/sda1 of=/some/remote/folder/sda1.img) I'm under the impression you can mount it, though mount may complain somewhat.

    Now, if you'd taken a dump of a full hard disk (e.g. sda) could you mount one of the partitions within it? Would you need to know the starting/ending sectorsof each partition?

  2. #2
    Join Date
    Feb 2007
    Beans
    4,045
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Can you mount a hard disk image?

    Yes, you need to supply the offset. You can use parted to find the correct offset. I've created a 10MiB image (drive.img) with two 3MiB partitions to use as an example; let's mount the second partition.
    Code:
    $ parted drive.img unit B print
    WARNING: You are not superuser.  Watch out for permissions.
    
    Disk /tmp/drive.img: 10485759B
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos
    
    Number  Start     End       Size      Type     File system  Flags
     1      16384B    3014655B  2998272B  primary  ext2              
     2      3014656B  6029311B  3014656B  primary  ext2              
    
    $ sudo mount -o loop,offset=3014656B drive.img /tmp/mnt
    $ ls /tmp/mnt
    lost+found

  3. #3
    Join Date
    Nov 2007
    Location
    UK
    Beans
    288
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Can you mount a hard disk image?

    That's such a elegant solution it's almost beautiful. Thanks for the concise example and explanation.

    P.S. It's also nice to know I won't have to write down the offsets before imaging and risk geting them wrong.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •