What is windows way to do `mount -o loop,rw,offset=X`?

4

I want to mount with -o loopoffset=70254080 an ./raspbian-jessie-lite.img onto ./mntpt folder. The rw parameter is the key here - I need to edit .iso insides (set wifi login\password) and save it back. How to mount with rw on Windows 10?


Bash on Windows gives to me no loop back devices found error, while recomended

panda@host:~$ sudo /sbin/modprobe loop.o
modprobe: ERROR: ../libkmod/libkmod.c:556 kmod_search_moddep() could not open moddep file '/lib/modules/3.4.0+/modules.dep.bin'

so I wonder, what is free or opensource or shareware software that allows to do such loopback mount thing on Windows 10?

DuckQueen

Posted 2016-10-09T18:05:21.493

Reputation: 79

Answers

1

The below powershell script will take an .iso and mount it to a directory. I assume it will work for .img, too, but am unsure if it will accept writing.

For example, $img_path of D:\my_stuff\mount_me.iso, will create a mount point at D:\my_stuff\mount_me\

Note that the command $drive.AddMountPoint requires admin privileges.

param([Parameter(Mandatory=$true, Position=1)] [string] $img_path)

##
# https://social.technet.microsoft.com/Forums/scriptcenter/en-US/d2faa6c3-35e8-4bad-8ac8-24902bbb6f1a/what-is-the-point-of-nodriveletter-in-mountdiskimage
##

$ErrorActionPreference = "Stop"

$mount_dir_path = Join-Path `
    ([System.IO.Path]::GetDirectoryName($img_path)) `
    ([System.IO.Path]::GetFileNameWithoutExtension($img_path))

if(-Not (Test-Path -Path $mount_dir_path -PathType "Container")) {
    $null = mkdir $mount_dir_path
}

$img = Mount-DiskImage -ImagePath $img_path -NoDriveLetter -PassThru
$vol = Get-Volume -DiskImage $img
$drive = Get-WmiObject "win32_volume" -Filter "Label = '$($vol.FileSystemLabel)'"
$mount_return = $drive.AddMountPoint($mount_dir_path)

if($mount_return.ReturnValue -ne 0) {
    # https://msdn.microsoft.com/en-us/library/aa384762(v=vs.85).aspx
    throw $mount_return
}

##

user2426679

Posted 2016-10-09T18:05:21.493

Reputation: 209

0

Not a windows-10 expert, but I presume that being able to use bash doesn't implies that you can use the whole GNU/linux toolchain.

No loop device on windows, as far as I know Also, no modprobe ( this is a specific of linux kernel ), and no mount probably ( this time, a specific of some file systems )

mtsdev

Posted 2016-10-09T18:05:21.493

Reputation: 141

1I'm guessing the OP used the Windows Subsystem for Linux (WSL) to run bash. WSL runs real, unmodified Linux EFI binaries, but it does not run them on a real Linux kernel but rather on a Linux-to-NT compatibility layer (in fact, it's basically the opposite of wine, which runs real Win32 binaries on a Win32-to-Linux compatibility layer). WSL does not support loading kernel modules, including drivers. – CBHacking – 2018-03-22T02:27:40.867