Mount minix parition under linux

263 views
Skip to first unread message

ajray

unread,
May 16, 2009, 1:00:55 AM5/16/09
to minix3
Hey,

I just recently got this figured out, so I thought I'd share:

Note: This only applies to baremetal installs, so VM users wont
benefit a whole lot (but its still interesting).

When I upgraded from 3.1.3 to 3.1.4 I forgot to move /usr/src/etc/
drivers.conf to its new place in /etc, and that may be one of the
reasons it's not booting properly (I'm guessing not though). Handily,
I have another partition on this computer, and I can use that to
manually move the file.

The first thing you need to do is get the size of each of your minix
partitions. You can do this from linux with:

$ fdisk /dev/sda1

or whichever primary partition and enter 'p' to print that partitions
information. It should give you three sub partitions, which are your
minix root, home and usr directories. Make a note of the size of each
one in blocks; mine are given at the end of this.

Next you have to mount the partitions as loop devices, the first one
is at an offset of 512 bytes from the beginning of the primary
partition (thats where the boot sector goes).

$ losetup /dev/loop0 /dev/sda1 -o 512

The first partition gave a size of 16384 Blocks (or 16384*1024 bytes),
so the offset for the start of the second partition is 512+16384*1024
=

$ losetup /dev/loop1 /dev/sda1 -o 16777728

The second partition gave a size of 1169408 Blocks (or 1169408*1024
bytes), so the offset for the start of the third partition is 16777728
+ 1169408*1024 = 1214251520 bytes.

$ losetup /dev/loop2 /dev/sda1 -o 1214251520

Now, you can mount the loop devices as if they were partitions:

$ mount /dev/loop0 /mnt/minixroot
$ mount /dev/loop1 /mnt/minixhome
$ mount /dev/loop2 /mnt/minixusr

And for me its now a trivial matter to copy the file over:

$ mv /mnt/minixroot/etc/drivers.conf /mnt/minixroot/etc/
drivers.conf.old
$ cp /mnt/minixusr/src/etc/drivers.conf /mnt/minixroot/etc/
drivers.conf

Thats it! I hope this isn't too much extra noise on the list; I just
thought I'd share.

I'd love to hear a better way of doing it if anyone has experience
with this.

Thanks,
~Alex

FDISK PRINT OF MINIX PARTITION:

Device Boot Start End Blocks Id System
/dev/sda1p1 * 1 3 16384 81 Minix / old
Linux
Partition 1 has different physical/logical endings:
phys=(2, 41, 9) logical=(2, 11, 9)
Partition 1 does not end on cylinder boundary.
/dev/sda1p2 3 148 1169408 81 Minix / old
Linux
Partition 2 has different physical/logical beginnings (non-Linux?):
phys=(2, 41, 10) logical=(2, 11, 10)
Partition 2 has different physical/logical endings:
phys=(156, 205, 13) logical=(147, 160, 13)
Partition 2 does not end on cylinder boundary.
/dev/sda1p3 148 737 4734128+ 81 Minix / old
Linux
Partition 3 has different physical/logical beginnings (non-Linux?):
phys=(156, 205, 14) logical=(147, 160, 14)
Partition 3 has different physical/logical endings:
phys=(783, 14, 63) logical=(736, 254, 63)
Partition 3 does not end on cylinder boundary.

Debjit

unread,
May 16, 2009, 4:46:50 AM5/16/09
to minix3
Hi,

> Next you have to mount the partitions as loop devices, the first one

I don't understand why do we have to mount the minix partitions as
loop devices.
I mount them as ordinary partitions. Is there some advantage in doing
so ?

As a aside, i face problems when copying files and folders from linux
to minix partitions.
Some files get corrupted. Am i missing something ?

Alexander Ray

unread,
May 17, 2009, 11:45:13 PM5/17/09
to min...@googlegroups.com
As far as my setup goes, Linux has problems mounting the 'minix
partition' because it is actually sub-partitioned into three distinct
filesystems:
/ (root)
/home
/usr

Your own setup may be different, but this is why attempting to mount
the minix (primary) partition by itself fails.

How are you able to mount them as ordinary partitions? I'm very
curious, because that could be much simpler than my method.

Debjit Biswas

unread,
May 20, 2009, 2:08:12 AM5/20/09
to minix3
The three partitions appear as different devices. Then i mount the the
partitions normally as

mount -t minix /dev/hda9 /mnt/minixroot
or in fstab as

/dev/hda9 /mnt/minixroot minix defaults,umask=007,gid=445 0 0

I am on Gentoo, kernel version 2.6.28. Strangely i can't mount the
partitions in 2.6.29.

Have you enabled support for minix subpartitions in kernel
configuration.

On May 18, 8:45 am, Alexander Ray <alexjray.n...@gmail.com> wrote:
> As far as my setup goes, Linux has problems mounting the 'minix
> partition' because it is actually sub-partitioned into three distinct
> filesystems:
> / (root)
> /home
> /usr
>
> Your own setup may be different, but this is why attempting to mount
> the minix (primary) partition by itself fails.
>
> How are you able to mount them as ordinary partitions? I'm very
> curious, because that could be much simpler than my method.
>

Alexander Ray

unread,
May 21, 2009, 1:09:52 AM5/21/09
to min...@googlegroups.com
On Wed, May 20, 2009 at 2:08 AM, Debjit Biswas <debji...@gmail.com> wrote:
>
> The three partitions appear as different devices. Then i mount the the
> partitions normally as
>
> mount -t minix /dev/hda9 /mnt/minixroot
> or in fstab as
>
> /dev/hda9   /mnt/minixroot  minix  defaults,umask=007,gid=445  0 0
>
> I am on Gentoo, kernel version 2.6.28. Strangely i can't mount the
> partitions in 2.6.29.
>
> Have you enabled support for minix subpartitions in kernel
> configuration.

No, I have not, so I suspect that's the problem.

Many thanks for the tip! That is certainly easier than what I was doing.

~Alex

Debjit Biswas

unread,
May 24, 2009, 7:47:31 AM5/24/09
to minix3
Well since the discussion is on i wanted to say that i've faced a lot
of problems while
copying files into the minix partitions from linux. Sometimes the
files are copied perfectly
sometimes only a blank file is created, and sometimes they are just
not copied but linux
shows the files.
Also, the df utility crashes in linux while calculating size of the /
usr partition in minix.

This makes it really difficult to download and install new packages.

I am running kernel version 2.6.28. (the minix partitions fail to
mount in 2.6.29)

Tomas Hruby

unread,
May 24, 2009, 4:10:58 PM5/24/09
to min...@googlegroups.com
> Well since the discussion is on i wanted to say that i've faced a lot
> of problems while
> copying files into the minix partitions from linux.

The linux minix fs does not seem to be 100% compliant with the current
native minix fs. I came across some problems when copying larger files
to minix fs. Some parts were returned as holes on minix, although
copying the data back to linux was ok. Also creating nodes does not
work on a loop device.

> I am running kernel version 2.6.28. (the minix partitions fail to
> mount in 2.6.29)

I've tried only 64bit 2.6.29 and the kernel didn't like it at all :(

I find mounting minix drives in linux usefult, unfortunately not
reliable.

Cheers,

T.

Ladislav Klenovic

unread,
May 25, 2009, 1:26:52 AM5/25/09
to minix3
Hi all,

did you try to use different size of block; other than 4KB? The 1KB
block size
seems to me ok. My linux kernel version is 2.6.27.x though.

Regards,
Ladislav.

Debjit Biswas

unread,
May 26, 2009, 5:04:26 AM5/26/09
to minix3

> did you try to use different size of block; other than 4KB? The 1KB
> block size

How do i change the block size without reformatting the partition ?

Ladislav Klenovic

unread,
May 26, 2009, 5:21:25 AM5/26/09
to minix3
I think you can't change it. You should choose that option during
installation.
However I must emphasize that regarding 1KB block size I've never made
any
stress or bigger investigation. Just did some file copy to/from
minix3.

Regards,
Ladislav

Tomas Hruby

unread,
May 26, 2009, 6:03:02 AM5/26/09
to min...@googlegroups.com
> I think you can't change it. You should choose that option during
> installation.
> However I must emphasize that regarding 1KB block size I've never made
> any
> stress or bigger investigation. Just did some file copy to/from
> minix3.

I think it is rather block size independent as it is more structural
problem. I have scenarious where copying a file in Linux to minix
partition and back gives you an exact copy. However, a file which I've
copied in Linux to minix with a file which I scped to minix differs.

You are just getting lucky that the problem does not appear in your
case.

Cheers,

T.

Ladislav Klenovic

unread,
May 27, 2009, 3:48:10 AM5/27/09
to minix3
I am wondering if anybody has observed these kind of problems with
older version of fs e.g. version 2.

Regards,
Ladislav
Reply all
Reply to author
Forward
0 new messages