# Adding an entry for EXT4 partion in /etc/fstab



## john_rambo (Sep 10, 2014)

Hi,

I am dual booting FreeBSD and Ubuntu. My Ubuntu's /home is on a separate EXT4 partition. I want add an entry in fstab so that it gets mounted automatically during boot.

Please help me out.


----------



## DutchDaemon (Sep 10, 2014)

https://wiki.freebsd.org/Ext2fs



> In FreeBSD ext2, ext3 and ext4 are not different filesystems: ext2 is the base filesystem and some features from ext3 and ext4 are supported. All features in FreeBSD's implementation follow UFS semantics and this can sometimes impose important differences. In the case of trim support, for example, the code to merge this feature from UFS is relatively simple but while on Linux this is a mount option, in FreeBSD's UFS this has to be set in tunefs, so it's basically unsupported in the BSD ext2fs.
> 
> - FreeBSD 9.x+ fully supports the async mode, which is the default on linux. Unlike linux, the default is to use the sync mode which will make your filesystem more reliable at the cost of some performance.
> 
> ...


----------



## john_rambo (Sep 10, 2014)

DutchDaemon said:
			
		

> https://wiki.freebsd.org/Ext2fs
> quote]
> .NOTE: If you are trying to mount Ext4 partitions remember to *specifically mount the filesystem read-only*.



This one is going to cause major inconvenience. Suppose I download a file under FreeBSD I will have to copy it to a flash drive and then reboot and copy it to the Ext4 partition under Linux.

Thanks a lot.


----------



## john_rambo (Sep 10, 2014)

@DutchDaemon,

I can*'*t figure out which one is sda2 here. There are so many with the name ad*

http://pastebin.com/jzcYMpas


----------



## DutchDaemon (Sep 10, 2014)

fdisk(8), e.g. `fdisk /dev/ada0`, `fdisk /dev/ad4`


----------



## wblock@ (Sep 10, 2014)

Probably ada0s2.  Use `file -s /dev/ada0s2` to see if it will identify the filesystem.


----------



## uzsolt (Sep 10, 2014)

If you want a common home partition, I think ZFS is a good choice. If you can, convert your home partition to ZFS (backup your data, "format" to ZFS, restore your data) and that's all


----------



## wblock@ (Sep 10, 2014)

Alternatively, use a VM and stop having to worry about EXT4 write compatibility.  And be able to run both systems at the same time.


----------



## john_rambo (Sep 10, 2014)

```
******* Working on device /dev/ada0 *******
parameters extracted from in-core disklabel are:
cylinders=310101 heads=16 sectors/track=63 (1008 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=310101 heads=16 sectors/track=63 (1008 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 131 (0x83),(Linux native)
    start 2048, size 48828125 (23841 Meg), flag 0
	beg: cyl 0/ head 32/ sector 33;
	end: cyl 1023/ head 254/ sector 63
The data for partition 2 is:
sysid 131 (0x83),(Linux native)
    start 48830173, size 239081763 (116739 Meg), flag 0
	beg: cyl 1023/ head 254/ sector 63;
	end: cyl 1023/ head 254/ sector 63
The data for partition 3 is:
sysid 130 (0x82),(Linux swap or Solaris x86)
    start 304689548, size 7887157 (3851 Meg), flag 0
	beg: cyl 1023/ head 254/ sector 63;
	end: cyl 1023/ head 254/ sector 63
The data for partition 4 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 287911953, size 16777152 (8191 Meg), flag 80 (active)
	beg: cyl 1023/ head 255/ sector 63;
	end: cyl 1023/ head 255/ sector 63
```


```
# file -s /dev/ada0s2
/dev/ada0s2: Linux rev 1.0 ext4 filesystem data, 
UUID=c084cc67-2c4f-4c2d-b192-3d
f5e9429147 (extents) (large files) (huge files)
```


```
# mount -t ext2fs -o ro /dev/ada0s2 /media/linux/
mount: /dev/ada0s2: Invalid argument
```

I tried a number of combinations but they didn't work.



			
				uzsolt said:
			
		

> If you want a common home partition, I think ZFS is a good choice. If you can, convert your home partition to ZFS (backup your data, "format" to ZFS, restore your data) and that's all



I didn't know that's possible. I am having a tough time copying my files to Linux partition but at the moment I have a huge amount of data, more than my external drive can store, but all those will be gone within a week.

I just found that there's Ubuntu PPA for installing ZFS support.  I will create a thread about this topic once I get rid of all those extra data.



			
				wblock@ said:
			
		

> Alternatively, use a VM and stop having to worry about EXT4 write compatibility.  And be able to run both systems at the same time.



Yes that's probably the easiest way but I, for some reason, don't like running any OS other than Windows (which I no longer use) in a VM.  Both FreeBSD and Ubuntu works for me.


----------



## MorgothV8 (Sep 11, 2014)

There is also (as far as I know) fuse for linux ext2,3,4.
Fuse is file system in user mode - look in ports.
There is for NTFS for example: fusefs-ntfs, ntfs4g etc.


----------



## uzsolt (Sep 11, 2014)

MorgothV8 said:
			
		

> There is also (as far as I know) fuse for linux ext2,3,4.


On sysutils/fusefs-ext4fuse's homepage:


> This is a read-only implementation of ext4 for FUSE.


I think a read-only home-partition isn't good idea


----------



## MorgothV8 (Sep 11, 2014)

yes, sorry.
I thought it was RW.
Didn't tried it - so this was only "suggestion".


----------



## john_rambo (Sep 11, 2014)

Installed fusefs-ext4fuse-0.1.3,1 package from repository.

Home page says 



> === Mounting ===
> You can mount a filesystem like this:
> $ ext4fuse <device> <mountpoint>



But its not working


```
#ext4fuse /dev/ada0s2 /media/linux/ 
fuse: failed to open fuse device: No such file or directory
```


----------



## uzsolt (Sep 11, 2014)

john_rambo said:
			
		

> ```
> #ext4fuse /dev/ada0s2 /media/linux/
> fuse: failed to open fuse device: No such file or directory
> ```


Try `kldload fuse`. If you want enable at boot, please add `fusefs_enable="YES"` to /etc/rc.conf.


----------



## john_rambo (Sep 11, 2014)

uzsolt said:
			
		

> john_rambo said:
> 
> 
> 
> ...



It worked. Now I can mount the partition and read the contents as root. Added the line to rc.conf. As user I see the drive icon in PCManFM but when I click on it I get 

```
Error opening directory '/media/linux' : Opertation not permitted
```
I have mounted my USB flash drive on /media/pen and I can read it as user so don't know whats going wrong here.


----------



## john_rambo (Sep 12, 2014)

Any suggestions? I am really stuck at this point. I tried adding my user account to the operator group, logged out and back in but same thing. Also, despite adding 
	
	



```
fusefs_enable="YES"
```
 to /etc/rc.conf I still need do `kldload fuse`.


----------



## bsdkeith (Sep 12, 2014)

Check that your user is allowed to access /media/linux.
If not, try `chown <username>:<usergroup> /media/linux` (substitute your username and usergroup).


----------



## t1066 (Sep 13, 2014)

On 10.0, add


```
fuse_enable="YES"
```

to /boot/loader.conf instead to enable fuse.


----------



## john_rambo (Sep 14, 2014)

bsdkeith said:
			
		

> Check that your user is allowed to access /media/linux.
> If not, try `chown <username>:<usergroup> /media/linux` (substitute your username and usergroup).



I tried that. It just kept printing invalid argument.

I did `#chown user1:user1 /media/linux`




			
				t1066 said:
			
		

> On 10.0, add
> 
> 
> ```
> ...



I am using PCBSD 10 at the moment. Things are a bit easy there for a newbie like me. By default PCBSD selected ZFS and the Ubuntu's 

grub was overwritten by PCBSD's grub. I have added an entry in /usr/local/etc/grub.d/40_custom but when I try to boot into 

Ubuntu I get 

```
'Error: Invalid Signature'
```
.  

http://forums.pcbsd.org/showthread.php?t=23024


----------

