# I can't mount an ext3 partition from FreeBSD.



## srobert (Jan 4, 2013)

I've recently installed Xubuntu on a separate partition on my laptop. I used the ext3 filesystem for this.

```
mount -t ext2fs /dev/ada0p4 /mnt
```
results in:

```
mount: /dev/ada0p4: Invalid argument
```
I can't figure out what I'm missing. This is with a recent install of the FreeBSD 9.1-RELEASE. I did a kldload the ext2fs modules. I also installed e2fsprogs from ports (though I'm not sure it was necessary).
The gpt partitioning is new to this laptop, so that might have something to do with it.

Here's what I've checked so far. 
kldstat:

```
[root@Acer ~]# kldstat
Id Refs Address            Size     Name
 1   14 0xffffffff80200000 1323388  kernel
 2    1 0xffffffff81612000 1f417    linux.ko
 3    1 0xffffffff81632000 832d     i915.ko
 4    1 0xffffffff8163b000 139a7    drm.ko
 5    1 0xffffffff8164f000 bf1d     ext2fs.ko
```

gpart:

```
[root@Acer ~]# gpart show -p
=>       34  488397101    ada0  GPT  (232G)
         34        128  ada0p1  bios-boot  (64k)
        162   73400192  ada0p2  freebsd-ufs  (35G)
   73400354   73400320  ada0p3  freebsd-zfs  (35G)
  146800674   73400320  ada0p4  linux-data  (35G)
  220200994   73400320  ada0p5  freebsd-ufs  (35G)
  293601314  184549376  ada0p6  freebsd-ufs  (88G)
  478150690   10246445  ada0p7  freebsd-swap  (4.9G)
```

file:

```
file -s /dev/ada0p4
/dev/ada0p4: Linux rev 1.0 ext3 filesystem data, UUID=dce82c80-32f6-4449-a98e-ed9c8c85f477 (needs journal recovery) (large files)
```


I'm not having any problem booting either FreeBSD on partition 2 and Xubuntu on partition 4 from grub2. 
But I'd sure like to be able to access some files on the Linux side from FreeBSD. 
I'll be grateful for any suggestions.


----------



## formateur_fou (Jan 4, 2013)

Did you try to run fsck on this partition from your Linux system ?
If you look at ext2fs man page, you see it only fully supports ext2.
I don't think you need to have ext2fs.ko running. Well, in fact, it gets loaded when needed...


----------



## srobert (Jan 4, 2013)

*You are Freakin' Awesome, formateur_fou!*



			
				formateur_fou said:
			
		

> Did you try to run fsck on this partition from your Linux system ?
> If you look at ext2fs man page, you see it only fully supports ext2.
> I don't think you need to have ext2fs.ko running.



That was it! You'd think that _"(needs journal recovery)"_ would have been a clue for me. But somehow I missed that even though I copied and pasted it into the forum.

I ran it from the FreeBSD system: 

```
[root@Acer ~]# fsck -t ext2fs /dev/ada0p4
e2fsck 1.42.6 (21-Sep-2012)
/dev/ada0p4: recovering journal
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Free blocks count wrong (5462988, counted=5462940).
Fix<y>? yes
Free inodes count wrong (2121770, counted=2121773).
Fix<y>? yes

[root@Acer ~]# mount -t ext2fs /dev/ada0p4 /mnt
[root@Acer ~]# mount
/dev/ada0p2 on / (ufs, local, journaled soft-updates)
devfs on /dev (devfs, local, multilabel)
/dev/ada0p4 on /mnt (ext2fs, local)
```
Success
Also, you're correct about not needing ext2fs.ko.


----------



## srobert (Jan 4, 2013)

Bingo!
That did the trick.


----------



## srobert (Jan 5, 2013)

*Update*

Subsequently, I booted to the Linux side and then rebooted back to FreeBSD.
I then had to run fsck again in order to mount the ext3 partition. Apparently, using it under Linux as the root directory leaves it in need of a filesystem check before it can be mounted under FreeBSD. I won't need to mount it often, so I could live with that for now. But it shouldn't be that way.


----------



## formateur_fou (Jan 6, 2013)

You're right, there was a clue in your message. ;-)
But I have an external disk, and I chose ext2 in the case I needed to access the data from a Linux machine. Quite often, even though this disk was used only by FreeBSD and umount before to be unplugged, I had to run fsck. Once Thunar was closed, I still had to kill processes that the fstat command reported to umount the disk. I can't remember what it was, maybe gamin.
I noticed improvements since I replaced Thunar by Xfe.


----------



## break19 (Jan 7, 2013)

Your Linux system is possibly not remounting the filesystem as readonly before it reboots/powers off.. to save on shutdown time.

Since it's a journaled filesystem, the distro people may (wrongly) assume that it's safe to simply sync all writes, wait a few seconds and then power off.

man fstab -- you can find ways of making your FreeBSD system run fsck on the filesystem at boot (but requires having the filesystem auto mounted at boot, I use the "late" option for all non-essential filesystems.)


----------

