documentation for the new resize command

along with some small fixes
This commit is contained in:
Jaromil 2012-01-17 12:36:41 +01:00
parent c72acdeaa9
commit f645bc59e1
2 changed files with 18 additions and 7 deletions

View File

@ -72,6 +72,14 @@ Changes the password of a tomb key file specified in the \fIfirst
argument\fR. It will need the old password to decode the key file, it
will then reencode it using the new password.
.B
.IP "resize"
Increase the size of a tomb file to the amount of megabytes specified
by the \fI-s\fI option (total amount of the new size). Tombs cannot be
made smaller with this command, only bigger. This command makes use of
the cryptsetup resize feature and the resize2fs command, hence it
supports only tombs formatted with an EXT filesystem.
.B
.IP "slam"
Closes a tomb like the command \fIclose\fR does, but in case it is in
@ -97,8 +105,8 @@ given. This is used to recoved buried keys from unsuspected places.
.B
.B
.IP "-s \fI<MBytes>\fR"
When creating a tomb, this option MUST be used to specify the size of
the new \fIfile\fR to be created, in megabytes.
When creating or resizing a tomb, this option MUST be used to specify
the size of the new \fIfile\fR to be created, in megabytes.
.B
.IP "-k \fI<keyfile>\fR"
When opening a tomb, this option can be used to specify the location

View File

@ -1145,6 +1145,7 @@ change_passwd() {
# {{{ - Resize
# resize tomb file size
resize_tomb() {
_message "Commanded to resize tomb $CMD2 to $opts[-s] megabytes"
if ! [ ${CMD2} ]; then
_failure "No tomb name specified for resizing"
elif ! [ -r "${CMD2}" ]; then
@ -1185,7 +1186,7 @@ resize_tomb() {
awk -vtomb="[$tombname]" '/^\/dev\/mapper\/tomb/ { if($7==tomb) print $1 }'`
if [ "$mounted_tomb" ]; then
_failure "the tomb $tombname is mounted: to resize, umount it ('tomb close $tombname' is your friend)."
_failure "the tomb $tombname is open, to resize it it needs to be close."
fi
# MB to bytes conversion
@ -1208,13 +1209,13 @@ resize_tomb() {
"$DD" if=/dev/urandom bs=4k count=${tombsize_4k} of="${tmp_resize}"
if [ $? = 0 -a -e "${tmp_resize}" ]; then
act "OK: `ls -lh ${tmp_resize}`"
xxx "OK: `ls -lh ${tmp_resize}`"
else
_failure "Error creating the extra resize $tmp_resize, operation aborted."
fi
cat "${tmp_resize}" >> "${CMD2}"
"${WIPE}" "${tmp_resize}"
${=WIPE} "${tmp_resize}"
local nstloop=`losetup -f`
if [ $? = 255 ]; then
@ -1266,6 +1267,8 @@ resize_tomb() {
_failure "resize2fs failed to resize $mapper"
fi
sleep 1 # needs to settle a bit
# close and free the loop device
cryptsetup luksClose "${mapper}"
losetup -d ${nstloop}