2022/9/13

create, mount veracrypt sd partition in device.

在 pi 上 build 好 static linked veracrypt 後,放到 target board 上 ,先測試 mount 已經 create 好的 partition:
# /data/veracrypt /dev/mmcblk1p1 /sd
Enter password for /dev/mmcblk1p1: 
Enter PIM for /dev/mmcblk1p1: 
Enter keyfile [none]: 
Protect hidden volume (if any)? (y=Yes/n=No) [No]: 
Error: No such file or directory:
dmsetup

VeraCrypt::Process::Execute:88
意思是需要 dmsetup 這個 tool。是 device-mapper tool

另外,這個 Error:
Error: /dev/mapper/control: open failed: No such device
Failure to communicate with kernel device-mapper driver.
Check that device-mapper is available in the kernel.
Incompatible libdevmapper 1.02.167 (2019-11-30) and kernel driver (unknown version).
Command failed.
是 kernel 沒有 DEVICE-MAPPER support
Device Driver -- Multiple device driver support(RAID and LVM) -- Device mapper support -- Crypt target support
mount OK. 做 dd test:
# dd if=/dev/zero of=./100M bs=1000000 count=100
100+0 records in
100+0 records out
100000000 bytes (95.4MB) copied, 19.239889 seconds, 5.0MB/s
和沒有用 veracrypt 的 sd card 比較:
# dd if=/dev/zero of=./100M bs=1000000 count=100
100+0 records in
100+0 records out
100000000 bytes (95.4MB) copied, 18.150534 seconds, 5.3MB/s
至於 cpu useage,用 uptime 來看,沒有差別。


Create encrypted partition
ref: command:
# /data/veracrypt -t -c --volume-type=normal /dev/mmcblk1p1 --encryption=aes --hash=sha-512 --filesystem=fat -p 12345 --pim=0 -k "" --random-source=/dev/urandom

Done: 100.000%  Speed: 5.3 MiB/s  Left: 0 s                

The VeraCrypt volume has been successfully created.
非常慢...2G 的 card 花了10 min..
查到有 --qick 做 quick format.. 測試..
# /data/veracrypt -t -c --volume-type=normal /dev/mmcblk1p1 --encryption=aes --hash=sha-512 --filesystem=fat -p 12345 --pim=0 -k "" --random-source=/dev/urandom --quick

Done: 100.000%  Speed: 115 MiB/s  Left: 0 s             

The VeraCrypt volume has been successfully created.
大概 15sec..

mount
# /data/veracrypt -p 12345 --pim=0 -k "" --protect-hidden=no /dev/mmcblk1p1 /sd
大概要 10sec.

這樣 create 出來的 disk 在 windows 系統,可以使用 veracrypt mount 起來。 read.write OK

沒有留言:

張貼留言