Skip to content

Commit 9a6be4f

Browse files
authored
Merge pull request #361 from mxpv/docs
Update quickstart
2 parents 83a742d + 6b170ab commit 9a6be4f

File tree

1 file changed

+49
-21
lines changed

1 file changed

+49
-21
lines changed

docs/quickstart.md

Lines changed: 49 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ sudo DEBIAN_FRONTEND=noninteractive apt-get \
4141
git \
4242
curl \
4343
e2fsprogs \
44-
util-linux
44+
util-linux \
45+
bc
4546

4647
cd ~
4748

@@ -61,7 +62,6 @@ sudo usermod -aG docker $(whoami)
6162
cd ~
6263

6364
# Check out firecracker-containerd and build it. This includes:
64-
# * block-device snapshotter gRPC proxy plugins
6565
# * firecracker-containerd runtime, a containerd v2 runtime
6666
# * firecracker-containerd agent, an inside-VM component
6767
# * runc, to run containers inside the VM
@@ -95,15 +95,54 @@ root = "/var/lib/firecracker-containerd/containerd"
9595
state = "/run/firecracker-containerd"
9696
[grpc]
9797
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"
102103
103104
[debug]
104105
level = "debug"
105106
EOF
106107

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+
107146
cd ~
108147

109148
# Configure the aws.firecracker runtime
@@ -132,33 +171,22 @@ sudo tee /etc/containerd/firecracker-runtime.json <<EOF
132171
EOF
133172
```
134173

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
147175

148176
```bash
149177
sudo firecracker-containerd --config /etc/firecracker-containerd/config.toml
150178
```
151179

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!
153181

154182
```bash
155183
sudo firecracker-ctr --address /run/firecracker-containerd/containerd.sock \
156184
image pull \
157-
--snapshotter firecracker-naive \
185+
--snapshotter devmapper \
158186
docker.io/library/debian:latest
159187
sudo firecracker-ctr --address /run/firecracker-containerd/containerd.sock \
160188
run \
161-
--snapshotter firecracker-naive \
189+
--snapshotter devmapper \
162190
--runtime aws.firecracker \
163191
--rm --tty --net-host \
164192
docker.io/library/debian:latest \

0 commit comments

Comments
 (0)