TRIM support on UFS2 FreeBSD 9

General questions about the FreeBSD operating system. Ask here if your question does not fit elsewhere.

TRIM support on UFS2 FreeBSD 9

Postby alie » 29 Nov 2011, 08:35

Do we have TRIM support on UFS2 FreeBSD 9?
[color="DarkRed"]www.alielee.com[/color]
FreeBSD FreeBSD 9.1-PRERELEASE #0 r243320 /usr/obj/usr/src/sys/EZYCLIE amd64
User avatar
alie
Member
 
Posts: 561
Joined: 11 Dec 2008, 08:13
Location: Somewhere in the world

Postby SirDice » 29 Nov 2011, 09:18

8.1 Release notes:
The ada(4) driver now supports BIO_DELETE. For SSDs this uses TRIM feature of DATA SET MANAGEMENT command, as defined by ACS-2 specification working draft. For Compact Flash use CFA ERASE command, same as ad(4) does. This change realizes restoring write speed of SSDs which supports TRIM command by doing newfs -E /dev/ada1, for example.


http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/ufs/ffs/ffs_alloc.c#rev1.153.2.4
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
User avatar
SirDice
Old Fart
 
Posts: 16185
Joined: 17 Nov 2008, 16:50
Location: Rotterdam, Netherlands

Postby alie » 29 Nov 2011, 12:26

I am not so familiar with this kind of thing and i have some questions
  1. How to check my [FILE]ada0[/FILE] already have TRIM feature on?
  2. Do i need to run this newfs command daily?
  3. How to turn on TRIM for existing filesystem?
[color="DarkRed"]www.alielee.com[/color]
FreeBSD FreeBSD 9.1-PRERELEASE #0 r243320 /usr/obj/usr/src/sys/EZYCLIE amd64
User avatar
alie
Member
 
Posts: 561
Joined: 11 Dec 2008, 08:13
Location: Somewhere in the world

Postby SirDice » 29 Nov 2011, 12:32

alie wrote:2. Do i need to run this newfs command daily ?

If you value your data, no.

From [man=8]newfs[/man]:
The newfs utility is used to initialize and clear file systems before first use.

And,
-E Erase the content of the disk before making the filesystem. The reserved area in front of the superblock (for bootcode) will not be erased.
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
User avatar
SirDice
Old Fart
 
Posts: 16185
Joined: 17 Nov 2008, 16:50
Location: Rotterdam, Netherlands

Postby alie » 29 Nov 2011, 13:01

Code: Select all
[/usr/home/ezyclie]# tunefs -p /dev/ada0p2
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)                                         disabled
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: optimization preference: (-o)                      time
tunefs: volume label: (-L)                                 


So it's not possible to enable trim support with:
Code: Select all
# tunefs -t enable /dev/ada0p2
[color="DarkRed"]www.alielee.com[/color]
FreeBSD FreeBSD 9.1-PRERELEASE #0 r243320 /usr/obj/usr/src/sys/EZYCLIE amd64
User avatar
alie
Member
 
Posts: 561
Joined: 11 Dec 2008, 08:13
Location: Somewhere in the world

Postby alie » 29 Nov 2011, 13:24

Okie solved:

Code: Select all
1. Single user mode
2. # mount
3. # tunefs -t enable /dev/ada0p2


Code: Select all
[/usr/home/ezyclie]# tunefs -p /dev/ada0p2
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: optimization preference: (-o)                      time
tunefs: volume label: (-L)                                 
[color="DarkRed"]www.alielee.com[/color]
FreeBSD FreeBSD 9.1-PRERELEASE #0 r243320 /usr/obj/usr/src/sys/EZYCLIE amd64
User avatar
alie
Member
 
Posts: 561
Joined: 11 Dec 2008, 08:13
Location: Somewhere in the world

Postby phoenix » 30 Nov 2011, 22:12

When in doubt, read the man page: [man=8]tunefs[/man]

It mentions in there you can't manipulate mounted filesystem unless they are mounted read-only. And several options can't be enabled until you run an [FILE]fsck[/FILE].
Freddie

Help for FreeBSD: Handbook, FAQ, man pages, mailing lists.
User avatar
phoenix
MFC'd
 
Posts: 3349
Joined: 17 Nov 2008, 05:43
Location: Kamloops, BC, Canada

Postby Petz » 01 Dec 2011, 12:07

Bummer, it would be nice to able to change these and have them take effect on reboot.
Petz
Junior Member
 
Posts: 43
Joined: 18 Nov 2008, 08:50
Location: Sydney, Australia


Return to General

Who is online

Users browsing this forum: Bing [Bot] and 0 guests