You are not logged in.

#1 2012-09-24 23:45:16

dake22
Member
Registered: 2012-09-24
Posts: 6

Mounting disk images with write support?

Hi everyone,
I have a question about Linux file mounting policies. Is it possible to mount a file (not necessarily a full file system image) containing a directory on a specific directory of the file system? I mean, if it would be possible to do something like mounting an ISO or IMG image (not in CDVD terms), but with write support. As far as I know, TAR containers wouldn't be reliable for this purpose due to its read-only nature. I kept in mind DMG technology from OSX, of which I know no equivalent in Linux. Another possibility I am considering is mounting that directory image in a ramdisk, if it wasn't possible to be mounted along the main filesystem.

But the main problem is on which technology could this idea rely on. The main point would be mounting a 'raw' directory image in a loop device at a desired mount point, but with write support?

I'm trying to develop some ideas related to this but I've never faced this case in linux, hope I've not looked like a jerk asking this..

Thanks for attention!!

Offline

#2 2012-09-25 00:08:35

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,362

Re: Mounting disk images with write support?

You can mount an incomplete filesystem, with the fact that when it hits an error it will realize there is something inconsistent.
Tar isn't a mountable filesystem, it's an archive.
You can create a file and then format the file with a filesystem.  It is mountable, and writable.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#3 2012-09-25 00:22:20

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Mounting disk images with write support?

What would be the purpose of this? Would 'mount --bind' work?

Offline

#4 2012-09-25 14:09:21

dake22
Member
Registered: 2012-09-24
Posts: 6

Re: Mounting disk images with write support?

Hi, and thanks for the answers.
I'm trying to find out a way to create self-contained applications in bundles, and mounting them wherever is convenient. My idea is to "pack" raw directories into single files, so that I can duplicate, migrate, or change easily. It's focused on making apps that may be conflictive to manage, for whatever the reason may be (switching between stable/unstable version testing, without breaking some systems, for example) easier to control, and avoiding dependencies conflicts.

Both the incomplete filesystem formatting and 'mount --bind' possibilities are very interesting to me.

In the first case, which container format should I use to do such, and then how do I format a file as an incomplete FS?
In the second case, would 'mount --bind' allow to mount directory images? (if there is so)

Is there any container format or image format which allowed to snap directories and then be mounted with write support?

Offline

#5 2012-09-25 14:28:05

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,362

Re: Mounting disk images with write support?

Chrooting is probably what you're looking for.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#6 2012-09-25 15:00:59

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Mounting disk images with write support?

What you're trying to do sounds a bit like static linking.

nomorewindows wrote:

Chrooting is probably what you're looking for.

+1

What about virtual machines like qemu, VirtualBox etc.?
I'm not sure, but mounting btrfs subvolume snaphots could be another way of testing things out.
If you run 'make' but not 'make install' you are not "polluting" your system and the app you've just built should work (if you provided all the libraries it needed for building etc.). I'm sure some distros have a better framework for this (gentoo?)

Offline

#7 2012-09-25 16:19:42

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,362

Re: Mounting disk images with write support?

karol wrote:

What you're trying to do sounds a bit like static linking.

nomorewindows wrote:

Chrooting is probably what you're looking for.

+1

What about virtual machines like qemu, VirtualBox etc.?
I'm not sure, but mounting btrfs subvolume snaphots could be another way of testing things out.
If you run 'make' but not 'make install' you are not "polluting" your system and the app you've just built should work (if you provided all the libraries it needed for building etc.). I'm sure some distros have a better framework for this (gentoo?)

With qemu at least, you can point it to boot to your tftp directory using iPXE.
I'm not sure about VirtualBox how you get the PXE to work on it other than using an iPXE iso to boot with.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#8 2012-09-25 22:25:31

dake22
Member
Registered: 2012-09-24
Posts: 6

Re: Mounting disk images with write support?

Thanks for the answers.

The main goal of my experiment is 'packaging' or 'concentrating in one directory' a full application bundled along with all of its necessary components and libraries, and making that package, container or directory mountable in order to run and operate the app. This way, I'd have a light-weigh Arch install, with no bloat for complementary components, apps or processes. I'd try out if app portability is possible between two different arch setups, too. It's just an experiment about an ideal system as a fully modular setup (whenever possible, of course!).

Chrooting is the probably the best option I've seen till now, with mount --bind. If possible I'd stay rather with ext3 or 4, because I haven't got any experience with other filesystems. The only thing I can't figure is if it's possible to create these images-files I referred before, images/snapshots of a directory to bundle, but that's a matter of personal preference, I found a single file much easier to manage than a directory.

Do you know how if it's possible to make an application installation process place all of the components in one single directory? PKGBUILD, pacman, yaourt...? It's some kind of isolating apps. I ask so because I think building from source would not automatically include necessary libraries, or am I wrong?

Second, do you think linux containers would be a better solution to do so?
https://github.com/mesos/mesos/wiki/Usi … Containers

Thank you once again, I really appreciate your help! (:

Offline

#9 2012-09-25 22:54:49

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Mounting disk images with write support?

I'm not sold on your idea of mounting stuff and I still think that - if possible - you could try some static linking: http://en.wikipedia.org/wiki/Static_lib … ic_linking
I've heard that it's hard / impossible with many modern apps and compilers but you can give it a shot.

Are you familiar with what GoboLinux did: http://www.gobolinux.org/?page=at_a_glance ?

Last edited by karol (2012-09-25 22:55:20)

Offline

#10 2012-09-26 01:23:41

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,362

Re: Mounting disk images with write support?

At least with VirtualBox, you can create snapshots.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#11 2012-10-21 20:33:20

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Mounting disk images with write support?

I'm not sure if it helps, but http://www.tomas-m.com/blog/18727-Dynam … ystem.html

I was searching for a way how to create a dynamic-size file for Slax changes so it could be loop-mounted. Didn't find anything useful thus had to write own filesystem driver for it using fuse. And that's how dynsizeFS has born. I plan to include it in Slax as a default way to store changes.

Offline

#12 2012-10-21 20:54:23

Šaran
Member
From: Bosnia
Registered: 2011-09-03
Posts: 407

Re: Mounting disk images with write support?

Chakra (Arch based) does excatly what you want through 'bundles'.

http://chakra-linux.org/bundles.html

Offline

#13 2012-10-21 21:06:18

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,362

Re: Mounting disk images with write support?

Šaran wrote:

Chakra (Arch based) does excatly what you want through 'bundles'.

http://chakra-linux.org/bundles.html

Isn't that like VirtualBox's virtual appliances?


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#14 2012-10-21 21:07:16

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Mounting disk images with write support?

nomorewindows wrote:
Šaran wrote:

Chakra (Arch based) does excatly what you want through 'bundles'.

http://chakra-linux.org/bundles.html

Isn't that like VirtualBox's virtual appliances?

You can read how they work here: http://chakra-linux.org/wiki/index.php/ … ndle_types

Offline

#15 2012-11-03 16:47:38

initbox
Member
Registered: 2008-09-27
Posts: 172

Re: Mounting disk images with write support?

You can create file that contains a filesystem and then mount it and use it normally.

I.e. just dd if=/dev/zero of=/blob bs=1G count=1; mkfs.ext4 /blob; mount /blob /mnt

Offline

Board footer

Powered by FluxBB