Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I try to execute the following command on an ubuntu 12.04 system:

sudo mount minix203.img -o loop -t minix /mnt/myminix/

in order to mount an .img file with minix partition; and get the following error instead:

mount: Not a directory

what is wrong with my command?

share|improve this question
    
does /mnt/myminix/ exist, and is it in fact a directory? –  tink Apr 15 '13 at 0:35
    
yes, it exists and is a directory –  infoholic_anonymous Apr 15 '13 at 0:38
add comment

2 Answers

I assume that it's true what Bruce said - that it contains whole partition table. Then there isn't anything unusable in that. For the following command you need util-linux in version 2.21 or higher.

sudo losetup --find --show -P minix203.img

That should attach your image to a loopback device and show you which loop device the image is attached to (eg. /dev/loop0). Assuming that, fdisk -l /dev/loop0 should show you the partition table and device names for you to be able to mount those. So you'll end up with something like:

sudo mount /dev/loop0p1 -t minix /mnt/myminix

Should work. Note that loop option is gone, losetup takes care of that part.

However, if you happen to not have util-linux package in right version, you can do this manually using fdisk and losetup (or better - install the package from external source). You'll just have to do some calculations in that case. First thing is to attach the image of whole drive:

sudo losetup --find --show part.img

That should tell you the device name - let's assume it's /dev/loop0. Then, try fdisk -l on it to get the partition layout:

fdisk -l /dev/loop0

For my file I get output like this:

Disk /dev/loop0: 67 MB, 67108864 bytes, 131072 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x2645940b

      Device Boot      Start         End      Blocks   Id  System
/dev/loop0p1            2048       63487       30720   83  Linux
/dev/loop0p2           63488      131071       33792   83  Linux

Don't get deceived, these might not be existent device names. You'll have to determine which partition do you want to mount using this table. Size or filesystem type should let you make some assumptions.

Now it's calculation time - you'll need an offset of your partition and it's size. You get that by multiplying sector sizes by unit size, to get result in bytes. You can see fdisk tells me that my sector size is 512 bytes, so if I want to mount /dev/loop0p1, it starts at (2048 * 512)-th byte. That is the offset and it's equal to 1048576 (in case of that example of course).

Size in sectors is end_sector_number - start_sector_number + 1, because these numbers are inclusive (end sector is within that size). Here it equals 61440 sectors == 31457280 bytes. That's what we needed.

You can detach loopback device now and reattach it limiting it's size constraints to the particular partition you'd like to mount (substite those numbers with your own):

sudo loopback -d /dev/loop0
sudo loopback -f --show -o 1048576 --sizelimit 31457280 part.img

It will probably attach it to /dev/loop0, which you can now safely mount:

mount -t minix /dev/loop0 /mnt/myminix

That should be almost fully operational, except for things that would normally affect the MBR of whole drive (like formatting with mkfs).

How does it work?

MBR partition table has a simple layout - there's 512 bytes of description first, where do partitions start, where they end, and then goes the data. With extended partitions it might be a little more difficult. You can set limits to your partition manually and that's kind of what kernel does for you on it's own, for your regular hard disk drives.

share|improve this answer
    
I get: losetup: invalid option -- 'P' –  infoholic_anonymous Apr 15 '13 at 1:32
    
Try to install loop-aes-utils package. –  TNW Apr 15 '13 at 1:57
    
losetup: invalid option -- '-', now it doesn't understand any of the options provided :/ –  infoholic_anonymous Apr 15 '13 at 8:27
    
@infoholic_anonymous I've done a little research, seems that the package containing right losetup is util-linux version >= 2.21. Your Ubuntu doesn't contain that, so I'll revise my main answer on how to do that manually. I think you can uninstall that previous package sudo apt-get purge loop-aes-utils. –  TNW Apr 15 '13 at 12:24
    
thanks. I used the new package and now I get mount: wrong fs type, bad option, bad superblock on /dev/loop2, missing codepage or helper program, or other error. the file .img is though ok, I run it on bochs with .bochsrc file given to me. Should I post it, would it help to guess the proper settings? –  infoholic_anonymous Apr 15 '13 at 15:38
show 3 more comments

That's a pretty old version of Minix.

There's a Google Groups page that has your answer on it. Quoting from that artilce:

In minix203.img there is a entire hd image including partition table. What mount finds at the beginning isn't the first partition but partition table. And so mounting fails.

I believe the same thing is true of newer Minix 3 ISO images, too. There's a little bitty Joliet filesystem, and a bigger Minix filesystem that the installer knows about. So you can't just mount the ISO image (loopback) and look at things.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.