From owner-freebsd-questions@freebsd.org Wed Aug 31 21:59:46 2016 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 2CF1FBCAF8D for ; Wed, 31 Aug 2016 21:59:46 +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 D8FAF2F2 for ; Wed, 31 Aug 2016 21:59:45 +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 u7VLxhw8071250 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 31 Aug 2016 15:59:43 -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 u7VLxhZT071247; Wed, 31 Aug 2016 15:59:43 -0600 (MDT) (envelope-from wblock@wonkity.com) Date: Wed, 31 Aug 2016 15:59:43 -0600 (MDT) From: Warren Block To: "Christoph P.U. Kukulies" cc: "freebsd-questions@freebsd.org" Subject: Re: dd blocksize when copying to SSD disk In-Reply-To: Message-ID: References: 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]); Wed, 31 Aug 2016 15:59:44 -0600 (MDT) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Aug 2016 21:59:46 -0000 On Wed, 31 Aug 2016, Christoph P.U. Kukulies wrote: > I'm about to copy an existing Windows 7 system to an SSD. Source drive is a > hard disk of 256 GB, destination drive a 500 GB Samsung SSD 850 EVO. > > Given the fact that unnecessary write operations to SSDs should be avoided > I'm thinking about the best strategy to use dd to write to the SSD. That is a strange conclusion to that sentence. dd(1) writes to every block, whether in use or not. As far as the SSD is concerned, blocks that have been written to are "in use" and can't be used for wear leveling. So... don't use dd if it can be avoided. If you must, be sure to leave some unwritten space on the SSD. But I would recommend using Clonezilla to copy the disk, or a utility from the SSD vendor. Clonezilla only copies blocks that are actually used by the filesystem. > The disk has a capacity (from linux-fdisk): of 500.1 GB (500107862016 bytes) > > That's 976773168 sectors. It has reportedly 60801 cylinders ( 255 heads, 63 > s/t gives 16065 sectors/cyl). > > When I calculate 976773168 / 60801 I'm getting 16065.0839... sectors / cyl - > why this uneven number? Is there an incomplete track left over? Blocks per track vary on modern drives, and doesn't apply at all on SSDs. Think of it as a pool of blocks. > After all, what would be the appropriate "bs"-parameter for the dd-command? For an SSD, anything between 64K and 8M would work. Smaller values too, but they would be unnecessarily slow. This has nothing to do with actual block size any more, which does not really apply to SSDs anyway. The bs= value is essentially a buffer size. > What about socalled "alignment"? Alignment is a thing with hard drives, because they have moving parts. Align partitions to 4K or 1M boundaries on SSDs and forget about it.