# Going all in, could use some help.



## pestslent1 (Dec 30, 2018)

I have a dual boot 2012r2 / Freebsd-12 (using ReFind): "ryzen 7 1700 (overclocked to 3700Mhz, if that matters) 32 GB of ram on a MSI x370 Gaming Plus motherboard with the latest bios". I have decided to go all in with FreeBSD and remove 2012r2. I have 2 backups of the "/" partition a "zfs snapshot -r zroot@backup" and one I made with "Clonezilla". My goal is to have 75-ish G ZFS / partition and keep the ufs partition at the end (nvd06).


```
oot@vmbsd:/usr/home/pete # gpart show nvd0
=>       34  488397101  nvd0  GPT  (233G)
         34       2014        - free -  (1.0M)
       2048     614400     1  ms-recovery  (300M)        I assume I do not need
     616448     204800     2  efi  (100M)                    Not sure if this needs to stay
     821248     262144     3  ms-reserved  (128M)        I assume I do not need
    1083392  107312766     4  ms-basic-data  (51G)       2012r2
  108396158   52370347     5  ms-basic-data  (25G)       Current / partition  (ZFS)
  160766505  327630630     6  freebsd-ufs  (156G)        I want to keep
```

My plan was to delete partitions 1,2,3,4 and 5 restart the box with my FreeBSD-12.0-RELEASE usb and install OS to the area of the deleted partitions using ZFS file system.
Then restore my original install to that partition using Clonzilla or zfs snapshot (I do not really understand how to restore the snapshot though).
Will that work?
Is there an easier way?
How would you suggest doing it.

Happy New Year,
Pete


----------



## Bobi B. (Dec 30, 2018)

Why don't you delete partitions 1 to 4, manually create new `freebsd-boot` partition 512 KB long as partition 1, allocate the space between partitions 1 and 5 for new `freebsd-zfs` partition, do `zfs send` and `zfs receive` from old partition 5 to new partition 2 (NVMe is not a hard drive, no heads to run all over the place), scrub new partition 2, then drop old partition 5, extend new partition 2 and install boot loader to make the system bootable? You can do all this if you boot from installation media and pick "live".

Of course, in any case, you should first backup the data you care for, partitions 5 & 6.

PS: Don't forget to align partitions; not sure what is the right value for NVMe, but lately I tend to align to 1MB. Speaking of which, partition 6 starts at odd sector number.


----------



## pestslent1 (Jan 2, 2019)

Bobi B. said:


> Why don't you delete partitions 1 to 4, manually create new `freebsd-boot` partition 512 KB long as partition 1, allocate the space between partitions 1 and 5 for new `freebsd-zfs` partition, do `zfs send` and `zfs receive` from old partition 5 to new partition 2 (NVMe is not a hard drive, no heads to run all over the place), scrub new partition 2, then drop old partition 5, extend new partition 2 and install boot loader to make the system bootable? You can do all this if you boot from installation media and pick "live".
> 
> Of course, in any case, you should first backup the data you care for, partitions 5 & 6.
> 
> PS: Don't forget to align partitions; not sure what is the right value for NVMe, but lately I tend to align to 1MB. Speaking of which, partition 6 starts at odd sector number.



Thanks for the help, I got it up and running. I tried to follow what you wrote but, my head exploded trying figure out the zfs send and zfs recieve. I could transfer every thing to the new partition but, got real confused about the pool being named different. I could not find many examples (A lot for just a backup or sending SSH) so I did this:

```
zfs snapshot -r zroot@backup
zfs send -R zroot@backup | zfs receive -F zbackup
```

Everthing seemed to transfer

Then I ran into confusion on the boot partititon: you suggested "freebsd-boot", in my research I found something else that said I should have "EFI" partition instead. Not being sure I picked EFI because, it is something I know (Windows). At this point I was really confused about how to make the new partition bootable (I did not know if what you suggested would work since I used a different type of boot partititon). I had read so many different things I could not figure out what would work for my setup) (The man pages seem to confuse me more than help, I like examples that I can modify for my use)

I ended up booting from the install media, manually making the EFI partition then deleted and created my ZFS partition for the install.
I then booted from clonezilla and restored my backup to the partititon I had made, rebooted and expanded the ZFS to fill the larger partition.
Deleted my ufs partititon and redid it (You said: Speaking of which, partition 6 starts at odd sector number) I did not know how to fix any other way.
I then added a swap partition (not sure if it is too big or even necessary with 32G of RAM)

```
root@vmbsd:/usr/home/pete # gpart show nvd0
=>       34  488397101  nvd0  GPT  (233G)
         34          6        - free -  (3.0K)
         40       1600     1  efi  (800K)
       1640  119537664     2  freebsd-zfs  (57G)
  119539304        408        - free -  (204K)
  119539712  352321536     3  freebsd-ufs  (168G)
  471861248   16535552     4  freebsd-swap  (7.9G)
  488396800        335        - free -  (168K)
```

All seems to work.  Does any thing look terribly amiss with the partitioning above?

I really would like to do it the FreeBSD way, I am trying to learn it  but, when I search for stuff about what I am trying to accomplish, It seems to be older, kinda confusing to me or I am not sure of the correct way to word my queries. I am a loooooong time windows user/technician and my brain does not absorb info like it use to.

Thanks Again.


----------



## Bobi B. (Jan 2, 2019)

Not sure about EFI partition. But then again, if your system is bootable, no point in making changes.

But as an example, here is a partition table on my end:

```
=>       34  234441581  ada4  GPT  (112G)
         34          6        - free -  (3.0K)
         40       1024     1  freebsd-boot  (512K)
       1064   16776184     2  freebsd-ufs  (8.0G)
...
```

To make my drive (`ada4`) bootable I should run `gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada4`. See Thread installing-freebsd-manually-no-installer.63201 if you want to learn more (it uses ZFS for root filesystem, hence installs another Nth stage boot loader `-p /boot/gptzfsboot`).

BTW what is the point of mixing UFS and non-redundant ZFS?


----------



## Sevendogsbsd (Jan 2, 2019)

If this is a UEFI motherboard (I have the 270), you don't need freebsd-boot, just a 200meg EFI partition. However, I have no idea how to do that with zfs, only ufs. I don't use ZFS except on my build server.


----------



## pestslent1 (Jan 2, 2019)

Bobi B. said:


> Not sure about EFI partition. But then again, if your system is bootable, no point in making changes.
> 
> But as an example, here is a partition table on my end:
> 
> ...



I wanted to get to know about the both of them (I need to use somthing to learn it), Most of my data drives are NTFS, I access them by passing them thrue to one of my behye vm's. This box basically just hosts 3 VM's, does some video encoding and hopefully teaches me more about FreeBSD.


----------



## pestslent1 (Jan 2, 2019)

Sevendogsbsd said:


> If this is a UEFI motherboard (I have the 270), you don't need freebsd-boot, just a 200meg EFI partition. However, I have no idea how to do that with zfs, only ufs. I don't use ZFS except on my build server.



Off Topic: if your user name means you own 7 dogs, I am also a dog hoarder, I have 6 Siberian Huskys.


----------



## Bobi B. (Jan 3, 2019)

pestslent1 said:


> I wanted to get to know about the both of them (I need to use somthing to learn it), Most of my data drives are NTFS, I access them by passing them thrue to one of my behye vm's. This box basically just hosts 3 VM's, does some video encoding and hopefully teaches me more about FreeBSD.


You can mount NTFS filesystems with ntfs-3g provided by sysutils/fusefs-ntfs.


----------



## Sevendogsbsd (Jan 3, 2019)

pestslent1 said:


> Off Topic: if your user name means you own 7 dogs, I am also a dog hoarder, I have 6 Siberian Huskys.



Sadly, yes - not by design but we do: 5 geriatric Shih Tzus and one Italian greyhound. Our 7th was a lab/pit mix but my son took him back, finally - we've been "dogsitting" him for most of his life.


----------



## pairoar (Jan 20, 2019)

Hello, 
if you didn't find solution mounting windows partion, you can try below ways

First, install  fusefs-ntfs
`pkg install fusefs-ntfs`


then you will add below 2 lines to /etc/rc.conf

```
# vim /etc/rc.conf
fuse_load=”YES”   
fusefs_enable="YES"
```

load fuesfs(4) into the kernel
`kldload fuesfs`

If there is no problem and assume  your ntfs partition is /dev/da1p2
`ntfs-3g /dev/da1p2  /mnt`

If you want to mount this partition at booting time, you can add below line into /etc/fstab.

```
# vim /etc/fstab
/dev/da1p2 /mnt ntfs mountprog=/usr/local/bin/ntfs-3g,rw,uid=1001,fmask=0644,dmask=0755      0       0
```


----------

