OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Apr 18, 2024 5:15 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Loopback Device / Image file handling
PostPosted: Mon Aug 09, 2010 7:15 am 
Offline
Member
Member
User avatar

Joined: Thu Nov 16, 2006 12:01 pm
Posts: 7614
Location: Germany
There is an article in the wiki that describes how to handle image files under Unix systems.

I have two problems with that:

1) In several places, the article is needlessly complicated. Most operations described therein can be done without setting up a dedicated loopback device. The 'fdisk' command under Linux can operate on files, 'mount' knows both the '-o loop' and the '-o offset=<...>' option. I started streamlining the article, then hesitated - is there any reason for the 'losetup' hoops the author is jumping through?

2) While the article gives a good idea how to handle image files under Unixes, and is linked as such from the main page, it is named "Loopback Devices". If I entered that as search keywords, a tutorial on setting up an image file with 'dd' and formatting it with 'mkfs.ext2' might not quite be what I was looking for (as mentioned on the discussion page). I'm not the person to write a page discussing loopback device architecture, but I'd suggest renaming the article (perhaps "Image files under Unix"), to avoid confusion and to make room for a potential article on loopback devices themselves.

_________________
Every good solution is obvious once you've found it.


Top
 Profile  
 
 Post subject: Re: Loopback Device / Image file handling
PostPosted: Mon Aug 09, 2010 3:53 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
The thing is that not all tools support disk images. The only thing losetup does is turn a file into a block device so that you can use it whenever you would try supplying a real disk. The various mkfs.* tools don't like regular files - they either prompt, require special switches, or even blatantly call the user stupid and refuse to work. Similarly, mounting wont work without (implicitly) using a loopback device - the magic mount is just syntactic sugar to avoid manual calling of losetup.

And for a lesser problem (probably a non-issue in your opinion), you have the users that expect the block device behaviour when using dd (as in not being able to write past the end of device, no truncation). And for the dirty hackers around, try to find out why program X does not work when called with a regular file rather than a device.

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
 Post subject: Re: Loopback Device / Image file handling
PostPosted: Tue Aug 10, 2010 9:20 am 
Offline
Member
Member
User avatar

Joined: Thu Nov 16, 2006 12:01 pm
Posts: 7614
Location: Germany
Well... If you put it that way. I usually strip tutorials to the minimum number of lines, steps, and generally "things involved", but I see where your argument is coming from.

_________________
Every good solution is obvious once you've found it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 46 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group