# Just installed FreeBSD 12 in a new SSD (120gb)



## Criosphinx (May 7, 2019)

I used the guided partitioning which creates efi (200m), root(about 102gb) and swap(3.8gb) partitions.

After the installation I rebooted into single-user mode and enabled TRIM in root.

As it is the first time I use an SSD with FreeBSD I want to know if I what I did is right and if there's anything else I should modify.


----------



## trev (May 8, 2019)

You might want to edit your /etc/fstab to mount your root partition with noatime, eg:

```
/dev/ada0pX /  ufs rw,noatime   1 1
```
 to stop every read of the SSD also doing a write to the SSD.


----------



## mfaridi (May 8, 2019)

Has tmpfs and mount it, can help you to have better performance.


----------



## Sevendogsbsd (May 8, 2019)

Trim should be enabled on all file systems on an SSD if I am not mistaken, not just /. I run 2 SSDs: one for / and one for /home. Trim is enabled on both.


----------



## Criosphinx (May 8, 2019)

The Auto(UFS) option from the installer created the following:






At firts boot I entered single-user mode and did:


```
tunefs -t enable /dev/ada1p2
```

After reboot:


```
tunefs -p /dev/ada1p2
tunefs: POSIX.1e ACLs: (-a)                                disabled
tunefs: NFSv4 ACLs: (-N)                                   disabled
tunefs: MAC multilabel: (-l)                               disabled
tunefs: soft updates: (-n)                                 enabled
tunefs: soft update journaling: (-j)                       enabled
tunefs: gjournal: (-J)                                     disabled
tunefs: trim: (-t)                                         enabled
tunefs: maximum blocks per file in a cylinder group: (-e)  4096
tunefs: average file size: (-f)                            16384
tunefs: average number of files in a directory: (-s)       64
tunefs: minimum percentage of free space: (-m)             8%
tunefs: space to hold for metadata blocks: (-k)            6408
tunefs: optimization preference: (-o)                      time
tunefs: volume label: (-L)
```

Trim can't be enabled for the other two partitions, because the first one, efi, is FAT32, and swap is free space if I understood correctly.

Should I instead use a swap file? like wblock's guide suggests: http://www.wonkity.com/~wblock/docs/html/ssd.html

Can it be done without starting over?


----------



## Sevendogsbsd (May 8, 2019)

Ah, I didn't know you were dual-booting. You are right - I don't think you can enable trim for fat32 or swap. I don't know the advantages or disadvantages of a swap partition vice file: someone more experienced than I will need to answer that. I normally have so much ram in my machines, none of them have ever hit swap, lol.


----------



## Criosphinx (May 8, 2019)

Wblock's guide says:

_"Allocating a partition ties up that swap space permanently, and data written to swap will not use TRIM.  So we will use a swap file.  Because the data goes through the file system, TRIM will be used, and the swap file can be resized without repartitioning the SSD."_

This is what I think I should do:

Disable swap with swapoff
Expand / with growfs
Create a 2GB swap file in /usr/swap and add it to fstab
Just a couple of doubts(if I'm not completely mistaken)

When creating the swap file should I do:

```
dd if=/dev/zero of=/usr/swap/swap bs=128k count=16384
```

or change the bs to something else?

Is it necesary to enable md with 
	
	



```
geom_md_load="YES"
```
 in /boot/loader.conf?


----------



## trev (May 9, 2019)

Beware using a swap file. See these PRs and the comments thereon:

o https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=206048
o https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194598
o https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=162455
o https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=140461


----------

