# Building disk up from scratch with gpart and UFS+SUJ



## Monti (Jul 19, 2015)

Hi!

I am trying to build up a 57GB SSD drive on an older amd64 machine with 2GB RAM from scratch with gpart where I would like to have UFS+SUJ file system on root and home partitions. But when coming to specifying that partition 2 should be mounted as / and partition 4 as /home I am coming to a halt. This including specifying that freebsd-ufs should be with +SUJ.

I have been plowing through gpart(8) and mount(8), but have not been able to find any solution. I have also done some web searches without any luck.

1. I started with a completely blank disk where I first created a GPT table with: `gpart create -s gpt ada0`

2. I then proceeded following the examples in gpart(8) adding the boot partition (partition 1): `gpart add -b 40 -s 88 -t freebsd-boot ada0`

3. Then proceeding with installing the bootstrap code with: `gpart bootcode -p /boot/gptboot -i 1 ada0`

4. Intended / partition (partition 2) with: `gpart add -s 20025M -t freebsd-ufs ada0`

5. SWAP partition (partition 3) with: `gpart add -t freebsd-swap -s 4146M ada0`

6. Intended /home partition (partition 4) with: `gpart add -s 33067M -t freebsd-ufs ada0`

It's the first time I am doing something like this and I think it's kind of "cool" actually doing it without any desktop gui and would really like to learn how this is done, but as mentioned I am at this point stuck when it comes to specifying +SUJ and the / and /home mount points (and I guess very possibly other things that I am not aware of yet also ).

Any help and guidance would be very much appreciated.

Thanks


----------



## tobik@ (Jul 20, 2015)

`gpart` only creates partitions, you still need to format them with newfs(8) (check out the -j option for soft updates journaling). fstab(5) contains examples on how to specify mount points for your home partition and adding your swap partition. IIRC there are no special options needed to mount UFS+SUJ filesystems.

The root filesystem can be specified in /boot/loader.conf:

```
vfs.root.mountfrom="ufs:/dev/ada0p2"
```


----------



## wblock@ (Jul 20, 2015)

Some of us avoid SUJ in favor of SU.  For me, that has been more reliable.  fsck(8) can take much longer, but it depends on how often it is needed.

For instructions, see Disk Setup On FreeBSD and Using a Solid State Drive with FreeBSD.


----------



## Monti (Jul 22, 2015)

Thanks a lot for your guidance guys! I really appreciate it.


Thanks for your man-links and elaboration tobik. Useful and good to know.

And thank you for information and links wblock@. Excellent tutorials! Loved the extra elaboration.

Using the guides I have set up the SSD hard drive with just SU and it seems to work very well. For me a new personal barrier broken 


One question wblock@; (Just wondering) If one delete the swap file in /usr/swap, will it be necessary to do the `dd if=/dev/zero of=/usr/swap/swap bs=128k count=32768` command again?


Again thank you guys


----------



## wblock@ (Jul 23, 2015)

Monti said:


> If one delete the swap file in /usr/swap, will it be necessary to do the  dd if=/dev/zero of=/usr/swap/swap bs=128k count=32768 command again?



If you want to recreate it, yes.


----------

