Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Nov 2012 12:10:38 -0700 (MST)
From:      Warren Block <wblock@wonkity.com>
To:        Gary Aitken <freebsd@dreamchaser.org>
Cc:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: 9.0 crash, ssd or filesystem problem?
Message-ID:  <alpine.BSF.2.00.1211161142300.76158@wonkity.com>
In-Reply-To: <50A66659.5040406@dreamchaser.org>
References:  <50A53FF1.7050806@dreamchaser.org> <alpine.BSF.2.00.1211151550050.66706@wonkity.com> <50A602AB.2060307@dreamchaser.org> <alpine.BSF.2.00.1211160746190.74281@wonkity.com> <50A66659.5040406@dreamchaser.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 16 Nov 2012, Gary Aitken wrote:

>
>>>>> ~$ gpart show ada0
>>>>> =>       34  250069613  ada0  GPT  (119G)
>>>>>         34        128     1  freebsd-boot  (64k)
>>>>>        162   41943040     2  freebsd-ufs  (20G)      /
>>>>>   41943202    1048576     3  freebsd-swap  (512M)    swap
>>>>>   42991778    8388608     4  freebsd-ufs  (4.0G)     /var
>>>>>   51380386    4194304     5  freebsd-ufs  (2.0G)     /tmp
>>>>>   55574690  192216088     6  freebsd-ufs  (91G)      /usr
>>>>>  247790778    2278869        - free -  (1.1G)
>>>>
>>>> It would not cause this problem, but those partitions are not aligned.
>>>> That would only affect speed, not reliability.
>>>
>>> geezes, it's not even on a 4K boundary from the get-go;
>>> not sure how that happened.
>>> let-alone the 1M boundary I just learned about.
>>
>> That's a normal install.  It's fine for 512-byte devices.
>> I have other suggestions too, but let's save that until the problem is fixed.
>
> aaahhh.  Vague recollections of getting this to boot up first time around.
>
> How about suggestions anyway, as I'm going to build an sata disk and move
> things to that as part of the process to see what's wrong.  May as well get
> it right-ish the first time; then repartition the SSD.

Okay.  The disk setup article shows alignment and using GPT labels, so 
I'll skip those.

Additional SSD suggestions: when creating partitions, leave out the swap 
partition.  If you have lots of memory, leave out the /tmp partition. 
Add that extra space to the /usr partition.

Format the UFS filesystems with -Ut, for soft updates and TRIM support. 
(Make sure your SSD supports TRIM, almost all do.)  (I don't use soft 
updates journaling.)

Use dd(1) to make a zero-filled file on /usr somewhere, say /usr/swap. 
Make it the size you want swap to be, and do not make it a sparse file. 
Tell the system to use the swapfile in /etc/rc.conf:

   swapfile="/usr/swap"

Use tmpfs for /tmp in /etc/fstab:

   tmpfs		/tmp	tmpfs	rw,mode=01777	0	0

It's possible to limit the size, but not necessary.  This /tmp will be 
cleared on reboot.


Now: why?

Using a swapfile through the filesystem gives three advantages:

1. Disk space is not tied up in an unused swap partition.
2. Swap can be resized without repartitioning.
3. Swap goes through the filesystem, using TRIM, helping the SSD
    maintain performance.

/tmp as tmpfs is auto-sizing, efficient, and self-clearing on reboot. 
It doesn't tie up disk space in a mostly-unused partition.

I use tmpfs for /usr/obj also.  It doesn't improve speed, but reduces 
writes to SSD and is also self-clearing.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.1211161142300.76158>