Skip to content

Commit 2f106a4

Browse files
committed
README.md: add qemu-kvm command to test the encrypted disk image
Signed-off-by: Kun Lai <[email protected]>
1 parent d57d386 commit 2f106a4

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

README.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,39 @@ We will use the Alinux3 disk image file from [here](https://mirrors.aliyun.com/a
2424
1. Download the Alinux3 disk image file (KVM x86_64 version with Microsoft Virtual PC format):
2525

2626
```sh
27-
wget https://alinux3.oss-cn-hangzhou.aliyuncs.com/aliyun_3_x64_20G_nocloud_alibase_20250117.vhd
27+
wget https://alinux3.oss-cn-hangzhou.aliyuncs.com/aliyun_3_x64_20G_nocloud_alibase_20250117.qcow2
2828
```
2929

3030
2. Convert the disk image file:
3131

3232
Here we will encrypt the disk image file with a provided passphrase (GkdQgrmLx8LkGi2zVnGxdeT) and configs from `./config_dir/` directory. The second parameter is the output file name.
3333

3434
```sh
35-
cryptpilot-convert --in ./aliyun_3_x64_20G_nocloud_alibase_20250117.vhd --out ./aliyun_3_x64_20G_nocloud_alibase_20250117_cc.vhd -c ./config_dir/ --passphrase GkdQgrmLx8LkGi2zVnGxdeT
35+
cryptpilot-convert --in ./aliyun_3_x64_20G_nocloud_alibase_20250117.qcow2 --out ./encrypted.qcow2 -c ./config_dir/ --passphrase GkdQgrmLx8LkGi2zVnGxdeT
3636
```
3737

38-
> Note: You can also use the --package parameter to install some packages/rpms to the converted disk.
38+
> Note: You can also use the --package parameter to install some packages/rpms to the disk, before the encryption.
3939
40-
3. Upload the converted disk image file to Aliyun and boot from it.
40+
41+
3. (optional) Test the converted disk image file:
42+
43+
You can launch a virtual machine with the converted disk image file and check that it works.
44+
45+
> Note: If you are using a `.vhd` file, you have to convert it to a `.qcow2` file first, before you launch it with qemu.
46+
47+
```sh
48+
yum install -y qemu-kvm
49+
50+
/usr/libexec/qemu-kvm \
51+
-m 4096M \
52+
-smp 4 \
53+
-nographic \
54+
-drive file=./encrypted.qcow2,format=qcow2,if=virtio,id=hd0,readonly=off \
55+
-drive file=./seed.img,if=virtio,format=raw
56+
```
57+
After you finished your tests, you can use Ctrl-A C to get to the qemu console, and enter 'quit' to exit qemu.
58+
59+
4. Upload the converted disk image file to Aliyun and boot from it.
4160

4261
### Convert a real system disk
4362

0 commit comments

Comments
 (0)