Switch to use unit suffix for --reduce-device-size option.
[platform/upstream/cryptsetup.git] / man / cryptsetup-reencrypt.8
index b15dc3d..d9a3202 100644 (file)
@@ -25,6 +25,9 @@ The reencryption can be temporarily suspended (by TERM signal or by
 using ctrl+c) but you need to retain temporary files named LUKS-<uuid>.[log|org|new].
 LUKS device is unavailable until reencryption is finished though.
 
+Current working directory must by writable and temporary
+files created during reencryption must be present.
+
 For more info about LUKS see cryptsetup(8).
 .PP
 .SH OPTIONS
@@ -105,9 +108,23 @@ Use re-encryption block size of <value> in MiB.
 
 Values can be between 1 and 64 MiB.
 .TP
-.B "\-\-reduce-device-size \fInumber of 512 bytes sectors\fR"
-Enlarge data offset for specified value of sectors by shrinking
-device size.
+.B "\-\-device-size \fIsize[units]\fR"
+Instead of real device size, use specified value.
+
+It means that only specified area (from the start of the device
+to the specified size) will be reencrypted.
+
+WARNING: This is destructive operation.
+
+If no unit suffix is specified, the size is in bytes.
+
+Unit suffix can be S for 512 byte sectors, K/M/G/T (or KiB,MiB,GiB,TiB)
+for units with 1024 base or KB/MB/GB/TB for 1000 base (SI scale).
+
+WARNING: This is destructive operation.
+.TP
+.B "\-\-reduce-device-size \fIsize[units]\fR"
+Enlarge data offset to specified value by shrinking device size.
 
 This means that last sectors on the original device will be lost,
 ciphertext data will be effectively shifted by specified
@@ -116,6 +133,8 @@ number of sectors.
 It can be usefull if you e.g. added some space to underlying
 partition (so last sectors contains no data).
 
+For units suffix see \-\-device-size parameter description.
+
 WARNING: This is destructive operation and cannot be reverted.
 Use with extreme care - shrinked filesystems are usually unrecoverable.
 
@@ -153,6 +172,25 @@ Cryptsetup-reencrypt returns 0 on success and a non-zero value on error.
 Error codes are: 1 wrong parameters, 2 no permission,
 3 out of memory, 4 wrong device specified, 5 device already exists
 or device is busy.
+.SH EXAMPLES
+.TP
+Reencrypt /dev/sdb1 (change volume key)
+cryptsetup-reencrypt /dev/sdb1
+.TP
+Reencrypt and also change cipher and cipher mode
+cryptsetup-reencrypt /dev/sdb1 -c aes-xts-plain64
+.TP
+Add LUKS encryption to not yet encrypted device
+
+First, be sure you have space added to disk.
+Or alternatively shrink filesystem in advance.
+.br
+Here we need 4096 512-bytes sectors (enough for 2x128 bit key).
+
+fdisk -u /dev/sdb # move sdb1 partition end + 4096 sectors
+
+cryptsetup-reencrypt /dev/sdb1 --new --reduce-device-size 4096
+
 .SH REPORTING BUGS
 Report bugs, including ones in the documentation, on
 the cryptsetup mailing list at <dm-crypt@saout.de>