Skip to contentSkip to conversation

cryptsetup luksFormat with the size option

dm-crypt Matthew Thode 3 participants 5 messages Feb 1, 2014 – Feb 2, 2014

lore
Share & tools
lore
#0 lore raw

Am I correct in stating that setting --size=8 will make the sectors 4k in size? Also, how can I check what existing luks volumes are set to?

Signature · 1 line
-- Matthew Thode
#1 lore raw
Quoted 6 lines · Matthew Thode

Am I correct in stating that setting --size=8 will make the sectors 4k in size? Also, how can I check what existing luks volumes are set to?

Signature · 1 line
-- Matthew Thode

No, you are not. As the man-page clearly states, this sets the size of the underlying device as multiple of 512B sectors.

As item 2.17 of the FAQ states, LUKS does not have any issue with 4k sectors, as it does not split or re-arrange requests.

I would strongly advise to read the documentation before trying to set up a LUKS volume. There are a number of less obvious pitfalls.

Arno

Signature · 4 lines
Arno Wagner,     Dr. sc. techn., Dipl. Inform.,    Email: [email protected]
GnuPG: ID: CB5D9718  FP: 12D6 C03B 1B30 33BB 13CF  B774 E35C 5FA1 CB5D 9718
----
A good decision is based on knowledge and not on numbers. -  Plato
#2 lore raw
Quoted 10 lines · Arno Wagner
Quoted 6 lines · Matthew Thode

Am I correct in stating that setting --size=8 will make the sectors 4k in size? Also, how can I check what existing luks volumes are set to?

--
-- Matthew Thode

No, you are not. As the man-page clearly states, this sets the size of the underlying device as multiple of 512B sectors.

I submit that for the luksFormat action, the --size option does _nothing_! The size is not recorded in the LUKS header, and luksFormat does not open the encrypted device, so there is neither a temporary nor a persistent effect from that option. In fact, there is not even a check that the requested size is within the limits of the underlying device.

Signature · 2 lines
Bob Nichols     "NOSPAM" is really part of my email address.
                Do NOT delete it.
#3 lore raw
Quoted 5 lines · Robert Nichols
Quoted 4 lines · Arno Wagner
Quoted 3 lines · Matthew Thode

Am I correct in stating that setting --size=8 will make the sectors 4k in size? Also, how can I check what existing luks volumes are set to?

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

--
-- Matthew Thode

No, you are not. As the man-page clearly states, this sets the size of the underlying device as multiple of 512B sectors.

I submit that for the luksFormat action, the --size option does _nothing_!

Yes. Nor should it. See the man-page:

--size, -b <number of 512 byte sectors>
Force the size of the underlying device in sectors of 512 bytes.
This option is only relevant for the open and resize actions.
^^^^ ^^^^^^

I do not see why this is apparently a surprise to some....

Quoted 4 lines

The size is not recorded in the LUKS header, and luksFormat does not open the encrypted device, so there is neither a temporary nor a persistent effect from that option. In fact, there is not even a check that the requested size is within the limits of the underlying device.

And why should there be? The underlying device could change. Or the kernel could change and with it the limits. Really, this is KISS at work. Watch and learn.

Arno

Signature · 4 lines
Arno Wagner,     Dr. sc. techn., Dipl. Inform.,    Email: [email protected]
GnuPG: ID: CB5D9718  FP: 12D6 C03B 1B30 33BB 13CF  B774 E35C 5FA1 CB5D 9718
----
A good decision is based on knowledge and not on numbers. -  Plato
#4 lore raw
Quoted 15 lines · Arno Wagner
Quoted 5 lines · Robert Nichols
Quoted 4 lines · Arno Wagner
Quoted 3 lines · Matthew Thode

Am I correct in stating that setting --size=8 will make the sectors 4k in size? Also, how can I check what existing luks volumes are set to?

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

--
-- Matthew Thode

No, you are not. As the man-page clearly states, this sets the size of the underlying device as multiple of 512B sectors.

I submit that for the luksFormat action, the --size option does _nothing_!

Quoted 8 lines

Yes. Nor should it. See the man-page:

--size, -b <number of 512 byte sectors>
Force the size of the underlying device in sectors of 512 bytes.
This option is only relevant for the open and resize actions.
^^^^ ^^^^^^

I do not see why this is apparently a surprise to some....

I was just pointing it out in the context of this thread, where it was not previously mentioned as meaningless.

Signature · 2 lines
Bob Nichols     "NOSPAM" is really part of my email address.
                Do NOT delete it.