# ext2 on whole disk



## dbi (Aug 9, 2009)

Hi,

I've made an ext2 FS on a whole disk in order to exchange files between FreeBSD and Linux. I didn't partition the hdd, but just made a file system [1] on it.
The drive appears as ad6 on the FreeBSD system, but mounting [2] doesn't work. No error/warning messages and /mnt becomes inaccessible.

[1] mkfs.ext2 /dev/sda​[2] mount -t ext2fs /dev/ad6 /mnt​

What am I doing wrong?


----------



## tangram (Aug 9, 2009)

dbi said:
			
		

> Hi,
> What am I doing wrong?



You need to take into account that FreeBSD names disks, slices and partitions diferently. Have a look at http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/disk-organization.html for more info.


----------



## dbi (Aug 9, 2009)

Yes, I knew about the difference between Linux and FreeBSD disk layouts and it's my mistake I didn't take it into account. Still the question remains. Is there any way to get the data from that disk? Perhaps a trick with dd and md or something like that?


----------



## aragon (Aug 9, 2009)

Maybe there's something wrong with the file system?  Is the inode size <=128 bytes?


----------



## Voltar (Aug 10, 2009)

Try running `# ls /dev/ | grep ad6` (ad6 being your ext2 disk) to see what FreeBSD actually sees slice/partition -wise. I'm going out on a limb here, but you might want ad6s1.

Also, if you created the drive in any recent version Linux distro the inode size will likely be > 128. If you're running 7-STABLE you should be able to mount the drive without issues, iirc, but 7.2-RELEASE and earlier won't be able to mount it without a patch.


----------



## dbi (Aug 10, 2009)

mount /dev/ad6[s1c,c,s1] were my second guesses when I found that "mount /dev/ad6" won't do and then I discovered there were no such entries under /dev:

```
ls -lah /dev/ad6                      
  crw-r-----  1 root  operator    0,  71 Aug 10 12:40 /dev/ad6
```
This is the only entry.
Also there's nothing wrong with the disk or the FS - they work perfectly well under Linux-2.6.30 (which is pretty recent). My FreeBSD installation however is 7.2-RELEASE-p3.


----------



## adamk (Aug 10, 2009)

If the inode size is 256, though, which is what most up-to-date linux distributions use, you won't be able to mount the filesystem without this patch:

http://pflog.net/~floyd/ext2fs.diff

You can read more about the issue here:

http://lists.freebsd.org/pipermail/freebsd-stable/2008-December/046916.html

I do not believe this patch was included in 7.2-RELEASE, and others on this thread seem to agree.

Adam


----------



## dbi (Aug 10, 2009)

*[solved]*

No, it appears the "above 128 byte inode size support" is not included in 7.2-RELEASE.

Patching and reloading [1],[2] ext2fs.ko didn't work either. Reformatting the partition under Linux with "mkfs.ext2 -I 128 ...." did the job, though.


At least now I know where the problem is and that I'll have to deal with it by other means.


Thanks, everyone.


[1] http://www.jimbrooks.org/web/freebsd/freebsd7_ext2_inode_patch.php
[2] http://pflog.net/~floyd/ext2fs.diff


----------

