unix:freebsd:system_builds:using_ssds
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | unix:freebsd:system_builds:using_ssds [2019/07/15 00:05] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Using SSD's with FreeBSD ====== | ||
+ | |||
+ | SSD's need a little extra attention on any operating system. These are some tricks I've discovered working with SSD's on FreeBSD. | ||
+ | |||
+ | ===== Doing an installation ===== | ||
+ | |||
+ | First we need to set up the boot drive. I found a great article at [[http:// | ||
+ | |||
+ | - Use manual disk partitioning | ||
+ | - Use GPT for the schema | ||
+ | - Create a small boot partition | ||
+ | - Create the root partition starting at 1M. This correctly aligns the file system under almost all circumstances. | ||
+ | - Create the filesystem with TRIM and Soft Updates on, but Soft Updates Journaling (SUJ) is **off** | ||
+ | |||
+ | You can choose to do this from a shell with the following (assuming drive is ada0, and it is a 112G SSD). | ||
+ | |||
+ | <code bash> | ||
+ | gpart create -s gpt ada0 | ||
+ | gpart add -t freebsd-boot -s 512k -a4k -l ssdboot ada0 | ||
+ | gpart bootcode -b /boot/pmbr -p / | ||
+ | gpart add -t freebsd-ufs -l ssdrootfs -b 1m ada0 | ||
+ | newfs -U -t / | ||
+ | </ | ||
+ | NOTE: in the referenced article, he breaks it down with separate partitions for /var and /usr. In my case, I do not want that, so I just build one partition. | ||
+ | NOTE: if your partition leaves 20% of disk space unused, it allows the device itself to do cleanup (called "under provisioning" | ||
+ | |||
+ | Now, finish your install and boot into your system. We will create a swap file (not partition) and make /tmp on a tmpfs system. | ||
+ | |||
+ | Create a swap file. Conventions say it should go into /usr. While we're at it, set /var/tmp as a softlink to /tmp: | ||
+ | <code bash> | ||
+ | # change bs and count to equal the size you want. When I use zfs, I make it 8G | ||
+ | dd if=/ | ||
+ | # fix /var/tmp | ||
+ | rm -fR /var/tmp | ||
+ | ln -s /tmp /var/tmp | ||
+ | # must use -h on soft links to set the permissions | ||
+ | chmod -h 777 /var/tmp | ||
+ | </ | ||
+ | |||
+ | Edit /etc/fstab to use the swap partition and, while we're in there, we'll set up a temp filesystem for /tmp | ||
+ | |||
+ | <code conf> | ||
+ | # make the swap file available for swap space | ||
+ | md99 | ||
+ | # use a tmpfs (ramdisk) for /tmp | ||
+ | tmpfs /tmp tmpfs rw, | ||
+ | </ | ||
+ | |||
+ | You can immediately activate the swap space with | ||
+ | <code bash> | ||
+ | swapon -aL | ||
+ | </ | ||
+ | |||
+ | Note that, if you reboot, anything that was in /tmp will stay there, but be hidden. It is **normally** ok to delete the contents of /tmp, but I always do it just before rebooting. If you want to clean up the extra few bytes, do the following: | ||
+ | |||
+ | <code bash> | ||
+ | rm -fR /tmp | ||
+ | mkdir /tmp | ||
+ | mount /tmp | ||
+ | reboot | ||
+ | </ | ||
unix/freebsd/system_builds/using_ssds.txt · Last modified: 2019/07/15 00:05 by 127.0.0.1