# EXT4 to ZFS



## john_rambo (Sep 12, 2014)

Hi,
I am dual booting FreeBSD and Ubuntu. I had created a separate home partition for Ubuntu which is Ext4. Since FreeBSD can mount Ext4 in read only mode I want to make it ZFS partition. I have installed ZFS support in Ubuntu.

I have created a new folder in Ubuntu's root partition and then created a new user account with its home in that folder and backed up all my data there. Finally I have temporarily removed the /home entry from Ubuntu's /etc/fstab.

These are my partitions 


```
# fdisk ada0
******* 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:
[color=#FF0000]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[/color]
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
```

I want to format ada0s2 which is Ext 4 to ZFS.  I don't want to try this myself because if I make a mistake everything may get wiped out. 

Please guide me with this.


----------



## nakal (Sep 12, 2014)

From what I read, you might not like it, but I still give you the advice that you should backup everything valuable first, before crying later. And notice that when you have backed up everything, you can start with a fresh installation and transfer all the files back to your new installation.

I understand handling of storage very well on FreeBSD, but even I would not do what you do, and especially not without a backup. Think about it.


----------



## john_rambo (Sep 12, 2014)

nakal said:
			
		

> From what I read, you might not like it, but I still give you the advice that you should backup everything valuable first, before crying later. And notice that when you have backed up everything, you can start with a fresh installation and transfer all the files back to your new installation.
> 
> I understand handling of storage very well on FreeBSD, but even I would not do what you do, and especially not without a backup. Think about it.



The amount of data I have is more than my external drive can store I will try this some other time. Since the only Linux file system which FreeBSD has read, write support for is ext2. Its a bit complicated.  I have installed the fusefs-ext4fuse-0.1.3,1 package from repository and I can mount the partition by doing `ext4fuse /dev/ada0s2 /media/linux/`. As user I see the drive icon in PCManFM but when I click on it I get  
	
	



```
Error opening directory '/media/linux' : Operation not permitted
```
 I just formatted the partition to FAT and added an entry for it in /etc/fstab. This time I can get to root of the partition with PCManFM but can't write to it.


----------



## chrbr (Sep 13, 2014)

Dear @john_rambo,
you first might want to think about which data is absolutely necessary to back-up. Just a copy of the files on the same drive gives a very limited amount of of safety.

Regarding the tests you like to do it might be also an idea to use an additional internal disk for the experiments. In best case it is of the about same size of your current disk. Then you can restore your current backups on the additional disk to be sure you are prepared for the worst case. If you have no backup up to now, it would be an option to try backup and restore to duplicate your current installations. Finally you will have one working installation and one setup for testing.

If you consider just the disk space you need just for the system you have the possibility to prepare more than a single installation on one disk. A disk with 100GB is more than enough for such a purpose. If this is not an option you might have access to an old spare computer which you can use for first tests.


----------

