0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

LXD:btrfsのストレージプールの容量を増やす

Last updated at Posted at 2024-05-31

はじめに

LXDのストレージプールでは、ブロックデバイス(/dev/sdb1のようなLinux上で認識可能なストレージデバイスあるいはパーティション)の他に、ボリュームのイメージファイル(ループバック・デバイス)でストレージを管理することが出来ます。(LXDのデフォルトはイメージファイルでのストレージ管理となっています)

ボリュームのイメージファイルは、予め指定した容量を確保し、確保された容量の範囲でLXD(LXC)コンテナ上のストレージとして利用することが可能です。しかし、LXDの活用が進むと容量が不足してくるケースも出てくるかと思います。

ストレージプールの容量が不足する場合は、イメージファイルの容量を増やすことで対応が可能です。ストレージドライバにbtrfsを指定して作成されたストレージプールは、以下の手順で簡単に容量を増やすことができます。

手順

1.ストレージの設定(編集)を開く

lxc storage edit default コマンドを実行し、テキストエディタ上で設定を編集します。

default はストレージプールに合わせて変更する

上記コマンドを実行すると、次のような設定が表示され、編集することができます。

### This is a YAML representation of a storage pool.
### Any line starting with a '#' will be ignored.
###
### A storage pool consists of a set of configuration items.
###
### An example would look like:
### name: default
### driver: zfs
### used_by: []
### config:
###   size: "61203283968"
###   source: /home/chb/mnt/lxd_test/default.img
###   zfs.pool_name: default

name: default
description: ""
driver: btrfs
status: Created
config:
  size: 30GiB
  source: /var/snap/lxd/common/lxd/disks/default.img
used_by:
- /1.0/images/7aadc272ba5913c8c334fdc9ee457e6dd7d4562a777816f2cdaf48314461b0d4
- /1.0/images/dd50a97865f3a71ea5bd3028c0a900473e80d1c3adcb7510584812339b871e6f
- /1.0/instances/hoge
- /1.0/instances/fuga
- /1.0/instances/piyo
- /1.0/profiles/default
locations:
- none

2.sizeの変更

1で開いた設定より、

config:
  size: 30GiB

config:
  size: 40GiB

のようにsizeを変更し(増やし)、保存します。

3.変更結果の確認

設定完了後、コンテナに入りボリュームの容量が増えていることを確認します。

変更前

# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0       30G  8.8G   20G  31% /

変更後

# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0       40G  8.8G   30G  23% /

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?