• Tutorial: How to mount raw images (.img) images on Linux

    If you have a few .img files coming as disk images from devices like floppies, CDs, DVDs, SD cards, etc, you will realize that  you cannot mount the in Linux, because they contain a file system that has to be mounted.

    In linux you would need to use the mount command as for any physical device, however you need to know the correct syntax that is based on understanding the information related to the partition(s) available in the image.

    First step is to read the partition Start point using fdisk:

    In the terminal type:

    sudo fdisk -l imgfile.img

    You will see an output similar to the one below:
    Device        boot    Start     End         Blocks      Id  System
    imgfile.img1      *             63           266544          722233           C     W95 FAT32 (LBA)
    imgfile.img2                   25679      25367890        245667890+      83    Linux

    As you can see there are two partitions, one that is FAT32 and the other one that it’s ExtFS. This means that to mount the first partition we have to tell Linux that we need to start at the sector 63. The standard sector size is 512 bytes, however there are other possibilities like 128 or 1024. Assuming that the place from where you are downloading the image doesn’t specify any sector size, we can type in the terminal:

    sudo mount -t vfat -o loop,offset=$((63 * 512)) imgfile.img /mnt/disk

    To mount the second partition, as you can imagine:

    mount -t ext4 -o loop,offset=$((25679 * 512)) imgfile.img /mnt/disk1

    It’s important to copy the “Start” sector number correctly, otherwise you’ll get an error message like:

    mount : wrong fs type, bad option, band superblock on /dev/loop,
    missing codepage or helper proggram, or other error
    In some cases useful info is found in syslog – try
    dmesg | tail or so

    One last thing, the standard sector size for CDs and DVDs is 2352 instead of 512. If you are opening such image, you’ll have to use this value instead of 512.

    Incoming search terms:

    • https://stefanoprenna com/blog/2014/09/22/tutorial-how-to-mount-raw-images-img-images-on-linux/
    • mount raw image linux
    • how to mount android raw image in ubuntu
    • linux mount boot img file
    • mount img file linux
    • mount ubuntu image
    • raw img dual boot
    • raw to img boot
  • Tutorial: how to automatically mount WebDAV shares at boot in Linux

    In Ubuntu (and Kubuntu or Lubuntu) you can quite easily access a WebDav (or WebDavs) share using the standard file manager: Nautilus, Konqueror or PcManFm.

    Just put in the address bar the site you want to open (for example: davs://yoursitename or webdav://yoursitename) and click on enter… That’s it (probably you will be asked for credentials – just put the right ones there…)!

    To make it work you only need to know if the connection is secure (davs) or not (webdav) and if the package davfs2 is installed (open a terminal and type “sudo apt-get install davfs2”).

    However in some cases you may want to have this share always mounted in your system and without the need to put credentials. If this is your case, the solution is pretty easy:

    Create a folder on your disk into which the web share will be mounted:
    sudo mkdir /mnt/sharename

    sudo nano /etc/davfs2/secrets

    add the line:
    https://www.yourshare.com username password

    and now you need to make sure the connection is made each time you start your computer:

    sudo nano /etc/fstab

    at the end of the file, on a new line type:

    https://www.yourshare.com/ /mnt/sharename    davfs   defaults,uid=username,gid=username,_netdev,auto  0       0

    Please note the options uid and gid, these are used to tell to the system which user will be able to write to the share (normally is root). In this case “username” is the one you use on your computer.
    The option “_netdev” tells to the system to wait for the connections to be up before attempting to mount the share (otherwise it will fail). The mount will happen automatically, as requested by the option “auto”.

    Incoming search terms:

    • pcman fm webdav
    • webdav mount on boot
    • fstab
    • linux automount dav
    • mount webdav automount using fstab
    • webdav centos 7 boot