@@ -41,7 +41,8 @@ sudo DEBIAN_FRONTEND=noninteractive apt-get \
41
41
git \
42
42
curl \
43
43
e2fsprogs \
44
- util-linux
44
+ util-linux \
45
+ bc
45
46
46
47
cd ~
47
48
@@ -61,7 +62,6 @@ sudo usermod -aG docker $(whoami)
61
62
cd ~
62
63
63
64
# Check out firecracker-containerd and build it. This includes:
64
- # * block-device snapshotter gRPC proxy plugins
65
65
# * firecracker-containerd runtime, a containerd v2 runtime
66
66
# * firecracker-containerd agent, an inside-VM component
67
67
# * runc, to run containers inside the VM
@@ -95,15 +95,54 @@ root = "/var/lib/firecracker-containerd/containerd"
95
95
state = "/run/firecracker-containerd"
96
96
[grpc]
97
97
address = "/run/firecracker-containerd/containerd.sock"
98
- [proxy_plugins]
99
- [proxy_plugins.firecracker-naive]
100
- type = "snapshot"
101
- address = "/var/lib/firecracker-containerd/naive-snapshotter.sock"
98
+ [plugins]
99
+ [plugins.devmapper]
100
+ pool_name = "fc-dev-thinpool"
101
+ base_image_size = "10GB"
102
+ root_path = "/var/lib/firecracker-containerd/snapshotter/devmapper"
102
103
103
104
[debug]
104
105
level = "debug"
105
106
EOF
106
107
108
+ # Setup device mapper thin pool
109
+ sudo mkdir -p /var/lib/firecracker-containerd/snapshotter/devmapper
110
+ cd /var/lib/firecracker-containerd/snapshotter/devmapper
111
+ DIR=/var/lib/firecracker-containerd/snapshotter/devmapper
112
+ POOL=fc-dev-thinpool
113
+
114
+ if [[ ! -f " ${DIR} /data" ]]; then
115
+ sudo touch " ${DIR} /data"
116
+ sudo truncate -s 100G " ${DIR} /data"
117
+ fi
118
+
119
+ if [[ ! -f " ${DIR} /metadata" ]]; then
120
+ sudo touch " ${DIR} /metadata"
121
+ sudo truncate -s 2G " ${DIR} /metadata"
122
+ fi
123
+
124
+ DATADEV=" $( sudo losetup --output NAME --noheadings --associated ${DIR} /data) "
125
+ if [[ -z " ${DATADEV} " ]]; then
126
+ DATADEV=" $( sudo losetup --find --show ${DIR} /data) "
127
+ fi
128
+
129
+ METADEV=" $( sudo losetup --output NAME --noheadings --associated ${DIR} /metadata) "
130
+ if [[ -z " ${METADEV} " ]]; then
131
+ METADEV=" $( sudo losetup --find --show ${DIR} /metadata) "
132
+ fi
133
+
134
+ SECTORSIZE=512
135
+ DATASIZE=" $( sudo blockdev --getsize64 -q ${DATADEV} ) "
136
+ LENGTH_SECTORS=$( bc <<< " ${DATASIZE}/${SECTORSIZE}" )
137
+ DATA_BLOCK_SIZE=128
138
+ LOW_WATER_MARK=32768
139
+ THINP_TABLE=" 0 ${LENGTH_SECTORS} thin-pool ${METADEV} ${DATADEV} ${DATA_BLOCK_SIZE} ${LOW_WATER_MARK} 1 skip_block_zeroing"
140
+ echo " ${THINP_TABLE} "
141
+
142
+ if ! $( sudo dmsetup reload " ${POOL} " --table " ${THINP_TABLE} " ) ; then
143
+ sudo dmsetup create " ${POOL} " --table " ${THINP_TABLE} "
144
+ fi
145
+
107
146
cd ~
108
147
109
148
# Configure the aws.firecracker runtime
@@ -132,33 +171,22 @@ sudo tee /etc/containerd/firecracker-runtime.json <<EOF
132
171
EOF
133
172
```
134
173
135
- 4 . Open a new terminal and start the ` naive_snapshotter ` program in the
136
- foreground
137
-
138
- ``` bash
139
- sudo mkdir -p /var/lib/firecracker-containerd /var/lib/firecracker-containerd/naive
140
- sudo naive_snapshotter \
141
- -address /var/lib/firecracker-containerd/naive-snapshotter.sock \
142
- -path /var/lib/firecracker-containerd/naive \
143
- -debug
144
- ```
145
-
146
- 5 . Open a new terminal and start ` firecracker-containerd ` in the foreground
174
+ 4 . Open a new terminal and start ` firecracker-containerd ` in the foreground
147
175
148
176
``` bash
149
177
sudo firecracker-containerd --config /etc/firecracker-containerd/config.toml
150
178
```
151
179
152
- 6 . Open a new terminal, pull an image, and run a container!
180
+ 5 . Open a new terminal, pull an image, and run a container!
153
181
154
182
``` bash
155
183
sudo firecracker-ctr --address /run/firecracker-containerd/containerd.sock \
156
184
image pull \
157
- --snapshotter firecracker-naive \
185
+ --snapshotter devmapper \
158
186
docker.io/library/debian:latest
159
187
sudo firecracker-ctr --address /run/firecracker-containerd/containerd.sock \
160
188
run \
161
- --snapshotter firecracker-naive \
189
+ --snapshotter devmapper \
162
190
--runtime aws.firecracker \
163
191
--rm --tty --net-host \
164
192
docker.io/library/debian:latest \
0 commit comments