# Re-partitioning FreeBSD on a working system



## balanga (Oct 11, 2014)

I installed FreeBSD 10.0-STABLE a few months ago to familiarise myself with it and now would like to reconfigure it if possible.

It was installed on a 150GB SSD disk originally and I subsequently added a 1TB sata disk which is now mounted on /mnt/disk. What I would like to do if possible is to have the whole installation split over the two disks. I'm not sure which partitions are best installed on SSD  and would welcome advise on how to split various mountpoints.

And can I repartition the system without having to reinstall?


----------



## Beeblebrox (Oct 11, 2014)

> I would like to install over the two disks. I'm not sure which partitions are best installed on SSD and would welcome advise on how to split various mountpoints.


Fist off, you can't assign partitions to zfs datasets, you can only assign partitions to zpools. This means you must have at least two separate zpools if you want to manually control which zfs dataset goes where. FYI, I use 3 zpools: bsdroot, build & mydata.

My HDD partitions:

```
SSD: ada0  GPT  (56G)
bios  (51K)
bsdroot  (53G)
zil  (3.0G)
grub  (64M)

Spindle: adaX  GPT  (932G)
swap  (6.0G)
build (100G)
mydata  (386G)
free -  (440G)
```
My ZFS dataset names & mount-point:

```
bsdroot         /
bsdroot/usr     /usr
bsdroot/var     /var
bsdroot/ccache  /build/poudriere/ccache

build        /build
build/git    /build/git
build/s11a   /build/s11a
build/s386   /build/s386
```
So basically, you can see that root is on the SSD and so is ccache, which has its mount-point changed to the build pool. zpool build is where I have /usr/src and /usr/ports (under compressed dataset build/git) and any other git pulls. s11a and s386 are the poudriere jails based on AMD and 386 architecture.

I have two spindle HDD's; mydata pool is mirrored and build zpool works as 2-disk JBOD (it's now really fast for compiling). The ZIL partition on the SSD is part of build pool but I don't think it has made much of a difference.


> Can I repartition the system without having to reinstall?


You tar all the pools you want to move to an empty partition, you boot into a FreeBSD live system (liveCD or mfsBSD) and procedd to destroy or re-size the partitions in question, then create the zpools, etc, as described on https://wiki.freebsd.org/RootOnZFS/GPTZFSBoot.
So in a sense no, it can't be done without a partial re-install process.

With the setup I described, you cannot have a mirrored bsdroot because the I/O difference between SSD and spindle HDD will drag the zpool performance down to the level of the spindle HDD, thus rendering it pointless to place bsdroot on the SSD.


----------



## user123 (Oct 15, 2014)

balanga said:
			
		

> And can I repartition the system without having to reinstall?


I did this quite often. Either for optimizing the partitions sizes or when exchanging the disks for larger ones.

Basically I then did the following:

Backup the data
Set up a temporary disk using the running system. (easiest using sysinstall)
Move the system and data to the temporary disk.
Update /etc/fstab on the temporary disk accordingly.
Make the temporary disk bootable using sysinstall.
(Exchange the old disks)
Install and set up the new disks, move data to them, update /etc/fstab on the new / partition and make them bootable like in step 5
Finally, remove the temporary disk

This way a system reinstall is unnecessary.
One of the many reasons I like FreeBSD so much is the simplicity to move the system onto other disks. Compare the hassles you encounter on W. and L. OSes if you need to do this...


----------



## balanga (Oct 15, 2014)

It's good to know that it can be done although it looks quite tricky especially for a novice like myself. I expect to give your method a try over the coming weeks when I work exactly how to go about it. I'm still trying to master how I should split the installation over two disks... ie working out what should go where. I have two disks, one of which is a 150GB SSD which has FreeBSD installed on it, the other is a 1TB Sata disk which is simply mounted under /mnt. I'm still unsure about all the partitions/slices which FreeBSD uses, but I think I might be able to get away with leaving the root partition where it is and relocating some of the others.


----------

