From owner-freebsd-questions@freebsd.org Sun Sep 6 16:53:20 2015 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0672E9CCC2A for ; Sun, 6 Sep 2015 16:53:20 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "wonkity.com", Issuer "wonkity.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id B8CAF15C for ; Sun, 6 Sep 2015 16:53:19 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.15.2/8.15.2) with ESMTPS id t86GrITB092876 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 6 Sep 2015 10:53:18 -0600 (MDT) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.15.2/8.15.2/Submit) with ESMTP id t86GrI8P092873; Sun, 6 Sep 2015 10:53:18 -0600 (MDT) (envelope-from wblock@wonkity.com) Date: Sun, 6 Sep 2015 10:53:18 -0600 (MDT) From: Warren Block To: "Brandon J. Wandersee" cc: freebsd-questions@freebsd.org Subject: Re: Replacing Drive with SSD In-Reply-To: <8637yro6nu.fsf@WorkBox.Home> Message-ID: References: <55E01DAE.1020709@infracaninophile.co.uk> <20150828084643.GB1274@xtaz.uk> <864mjj1fh3.fsf@WorkBox.Home> <8637yro6nu.fsf@WorkBox.Home> User-Agent: Alpine 2.20 (BSF 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (wonkity.com [127.0.0.1]); Sun, 06 Sep 2015 10:53:18 -0600 (MDT) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2015 16:53:20 -0000 On Sun, 6 Sep 2015, Brandon J. Wandersee wrote: > > Warren Block writes: > >> The SSD keeps a map of which blocks have been written. So writing just >> once with dd is not a wear problem. The problem is that now the SSD has >> no way of knowing whether that block has real data on it or not. So it >> can't swap it for wear leveling. That's what trim does--when a file is >> deleted, the filesystem uses trim to notify the SSD that those blocks >> are no longer in use. > > Would this also apply to a *single file* written using dd? Your SSD > guide recommends creating a swap file from /dev/zero using dd: > >> Because the data goes through the file system, TRIM will be used, and >> the swap file can be resized without repartitioning the SSD. > > So is the problem with dd and SSDs only relevant when targeting a whole > block device? Yes. Well, really it is about writing with methods that do not track whether a block is in use. When that swap file is deleted, UFS tells the SSD that all those blocks are no longer in use. dd(1) does not even have the concept of blocks being used or not, it just copies data.