それマグで!

知識はカップより、マグでゆっくり頂きます。 takuya_1stのブログ

習慣に早くから配慮した者は、 おそらく人生の実りも大きい。
") }) jQuery.noConflict()(document).ready(function(){ /**ページャーが気に入らないので修正**/ //やるべきこと // pre・next のいれかえ jQuery('span.pager-next').insertAfter('span.pager-prev') // pre/next に矢印を入れる jQuery('a[rel=next]').text(jQuery('a[rel=next]').text()+"> ") jQuery('a[rel=prev]').text("< "+jQuery('a[rel=prev]').text()) // pre/next をヘッダにもってくる //jQuery(".date.first").css("display","inline-block") jQuery('div.permalink.pager').clone().insertAfter(".date.first") jQuery("header .pager a").css("padding","0px 15px"); //pre/next をAjaxで取得してタイトルを取る。 //取得したタイトルをpre/next のタイトルに jQuery('span.pager-next,span.pager-prev').css("display","inline-block") jQuery('span.pager-next,span.pager-prev').css("width","250px"); jQuery('span.pager-next,span.pager-prev').css("overflow", "hidden"); jQuery('span.pager-next,span.pager-prev').css("white-space", "nowrap"); jQuery('span.pager-next,span.pager-prev').css("text-overflow", "ellipsis"); jQuery("a[rel=next],a[rel=prev]").each(function(idx,e){ var anchor = e jQuery.get(anchor.href,null,function(html){ jQuery(anchor).text() var title = jQuery("
").html(html).find(".entry-title").text().trim() jQuery(anchor).attr("title", title); text = jQuery(anchor).text() text = text.slice(0,10); text = text.replace(/の記事/, "の記事 ["+title+"] "); jQuery(anchor).text(text) }) }); }); })

lxc の root ストレージを作り直す。( Failed getting root disk: No root device could be found)

LXC のstorage を作り直す

LXCを整理するのには、ストレージを消して作り直すと手っ取り早い

ストレージをすべて消して空っぽにした状態

takuya@:~$ lxc storage ls
+------+--------+--------+-------------+---------+-------+
| NAME | DRIVER | SOURCE | DESCRIPTION | USED BY | STATE |
+------+--------+--------+-------------+---------+-------+

lxc のストレージを消すには、used by で利用しているlxd インスタンスをlxc delete $NAMEで消す必要もある。

lxc コマンドは、次のようにすると、sudo なし一般ユーザも利用可能。

sudo usermod -aG lxd takuya

ストレージを再生成する。

lxc storage create  default btrfs

root (イメージ保存先)を割り当てる。

path=/ を割り当てる。

lxc profile device add default root disk path=/ pool=default

この作業を忘れると、次のように root device (stoage ) がないと怒られる。

Failed getting root disk: No root device could be found

btrfs の圧縮オプションを入れておく。

btrfs は圧縮オプションを入れておくといいかもしれない。(おまじない)

lxc storage set default btrfs.mount_options compress=zstd

zstd 圧縮が効いていることを確認

lxc storage get default btrfs.mount_options

イメージをlaunchして確認

LXC_NAME=test-ubuntu
RELEASE=22.04
lxc launch ubuntu:$RELEASE $LXC_NAME

btrfs の圧縮オプションが効いていることも確認

lxc exec $LXC_NAME 'mount' | grep btrfs | grep zstd

/var/snap/lxd/common/lxd/disks/default.img 
on / type btrfs (rw,relatime,idmapped,compress=zstd:3,
ssd,space_cache=v2,user_subvol_rm_allowed,
subvolid=257,subvol=/containers/test)

btrfs なんで subvol=/containers/test でLXC_NAMEが入っていて、compress=zstd:3, になって圧縮オプションも継続していることが確認できる。

まとめ

lxc のストレージの作り直し。

lxc storage delete $NAME
lxc storage create $NAME
lxc profile device add default root disk path=/ pool=$NAME

lxd init をしてもいいけど、ストレージだけ作り直せる。使えると便利。