From owner-freebsd-fs@freebsd.org Fri Feb 10 18:23:03 2017 Return-Path: Delivered-To: freebsd-fs@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 90438CD9426 for ; Fri, 10 Feb 2017 18:23:03 +0000 (UTC) (envelope-from dpchrist@holgerdanske.com) Received: from holgerdanske.com (holgerdanske.com [IPv6:2001:470:0:19b::b869:801b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.he.net", Issuer "GeoTrust SSL CA - G4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7FDD1879 for ; Fri, 10 Feb 2017 18:23:03 +0000 (UTC) (envelope-from dpchrist@holgerdanske.com) Received: from ::ffff:99.100.19.101 ([99.100.19.101]) by holgerdanske.com with ESMTPSA (AES128-SHA:SSLv3:Kx=RSA:Au=RSA:Enc=AES(128):Mac=SHA1) (SMTP-AUTH username dpchrist@holgerdanske.com, mechanism PLAIN) for ; Fri, 10 Feb 2017 10:23:00 -0800 From: David Christensen Subject: Re: [dm-crypt] crypetsetup and GPT partitions To: freebsd-fs@freebsd.org References: <1f86c8f792254594b9f2de8706b05a38@useimail1301.ATL.CW.LOCAL> <6c94de98-9eb1-98d8-a916-1a554eb5b56c@holgerdanske.com> <20170210090753.GQ5418@yeono.kjorling.se> <2a5021f8-ef04-46fd-3696-fde01d5c7ea2@holgerdanske.com> <364af67e-05ca-2527-37a9-c157174ce1b6@whgl.uni-frankfurt.de> Message-ID: <1e0634d6-c880-7282-0f49-c4d96c3dfc2d@holgerdanske.com> Date: Fri, 10 Feb 2017 10:23:02 -0800 User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <364af67e-05ca-2527-37a9-c157174ce1b6@whgl.uni-frankfurt.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Feb 2017 18:23:03 -0000 On 02/10/17 08:22, Sven Eschenberg wrote: > Am 10.02.2017 um 17:05 schrieb David Christensen: >> On 02/10/17 01:07, Michael Kjörling wrote: >>> On 10 Feb 2017 00:15 -0800, from dpchrist@holgerdanske.com (David >>> Christensen): >>>> The available space of the LUKS mapped device is going to be smaller >>>> than the partition size. On one of my 3 TB drives, it's about ~44 >>>> GB smaller (~1.6%). The LUKS meta-data is going to be in there, >>>> including the header. >>> >>> That doesn't make sense. The LUKS header is a shade over 1 MiB, >>> depending on the specific options (the FAQ has details). The size of >>> the header isn't related to the size of the container. Something else >>> is going on in your case. >> >> Here's the data: >> >> 2017-02-10 07:38:40 root@cd2533 ~ >> # parted /dev/sda u s p >> Model: ATA ST3000DM001-1ER1 (scsi) >> Disk /dev/sda: 5860533168s >> Sector size (logical/physical): 512B/4096B >> Partition Table: gpt >> >> Number Start End Size File system Name Flags >> 1 2048s 5860532223s 5860530176s primary >> >> 2017-02-10 07:40:57 root@cd2533 ~ >> # df | egrep 'File|mnt' >> Filesystem 1K-blocks Used Available Use% Mounted on >> /dev/mapper/i3000d_crypt 2884281560 848596104 1889172304 31% /mnt/i3000d >> >> >> Here's the math: >> >> 5860530176 s / (2 s/kB) - 2884281560 kB >> = 2930265088 kB - 2884281560 kB >> = 45983528 kB >> ~= 44905.8 MB > That's the size of the filesystem afterall. D'oh! > Lookt at blockdev --report to see the blockdev sizes (i.e. physical > disk, partition, crypt device). RTFM blockdev(8): 2017-02-10 10:01:08 root@cd2533 ~ # blockdev --report /dev/sda /dev/sda1 /dev/mapper/i3000d_crypt RO RA SSZ BSZ StartSec Size Device rw 256 512 4096 0 3000592982016 /dev/sda rw 256 512 4096 2048 3000591450112 /dev/sda1 rw 256 512 4096 0 3000589352960 /dev/mapper/i3000d_crypt So, it looks like LUKS consumes: 3000591450112 - 3000589352960 = 2097152 = 2 MB Thanks for the correction. :-) > Check against dmsetup RTFM dmsetup(8): 2017-02-10 10:14:06 root@cd2533 ~ # dmsetup info /dev/mapper/i3000d_crypt Name: i3000d_crypt State: ACTIVE Read Ahead: 256 Tables present: LIVE Open count: 1 Event number: 1 Major, minor: 254, 2 Number of targets: 1 UUID: CRYPT-LUKS1--i3000d_crypt_unformatted > --table RTFM dmsetup(8), the --table option requires a value. WAG: 2017-02-10 10:14:17 root@cd2533 ~ # dmsetup info --table LIVE /dev/mapper/i3000d_crypt Name: i3000d_crypt State: ACTIVE Read Ahead: 256 Tables present: LIVE Open count: 1 Event number: 1 Major, minor: 254, 2 Number of targets: 1 UUID: CRYPT-LUKS1--i3000d_crypt_unformatted I'm not sure what I am checking... David