Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
113-Btrfsのスナップショット.pdf
Search
Satoru Takeuchi
PRO
May 25, 2026
40
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
113-Btrfsのスナップショット.pdf
Satoru Takeuchi
PRO
May 25, 2026
More Decks by Satoru Takeuchi
See All by Satoru Takeuchi
119-多機能ファイルシステムBtrfs_のコピー.pdf
sat
PRO
1
66
Linuxカーネルの インタフェースは変わりうる?
sat
PRO
1
92
あなたの知らないバージョン命名規則
sat
PRO
3
890
Rook: Intro and Deep Dive with Ceph
sat
PRO
1
64
Machine Check Exception
sat
PRO
2
64
バイナリダンプの模様を読む
sat
PRO
0
88
cpコマンドはディスク上でデータを コピーしないことがある
sat
PRO
3
87
114-ファイルのshallow_copy.pdf
sat
PRO
2
57
システム強制終了時にファイルシステムの整合性を保つ~ コピーオンライト編 ~
sat
PRO
0
76
Featured
See All Featured
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
370
Building Applications with DynamoDB
mza
96
7.2k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
520
Paper Plane
katiecoart
PRO
2
53k
Evolving SEO for Evolving Search Engines
ryanjones
0
280
A designer walks into a library…
pauljervisheath
211
25k
Test your architecture with Archunit
thirion
2
2.4k
Optimising Largest Contentful Paint
csswizardry
37
3.9k
Designing for Performance
lara
611
70k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
710
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
Done Done
chrislema
186
16k
Transcript
Btrfsのスナップショット May. 25th, 2026 Satoru Takeuchi X: satoru_takeuchi 1
• Btrfsがサポートしているファイルシステムレベルでのスナップショット • CoW(Copy-on-Write)機能を利用して実現 ◦ 📝 過去動画: その112 システム強制終了時にファイルシステムの整合性を保つ ~
コピーオンライト 編 ~ • スナップショットそのものが何かについては過去動画を参照 ◦ 📝 過去動画: その29 スナップショット はなすこと 2
サブボリューム • Btrfsでsnapshotを作成する単位(ここでは/mntにbtrfsをmountしている) • ファイルシステム上はディレクトリに見える 3 # btrfs subvolume create
/mnt/foo # 作成 Create subvolume '/mnt/foo' # ls /mnt # ディレクトリに見える foo # ls /mnt/foo # 中でlsもできる #
snahshot • foo以下に適当にファイルを作る • fooのsnapshot作成 4 # echo bar >/mnt/foo/bar
# echo baz >/mnt/foo/baz # ls /mnt/foo/ bar baz # btrfs subvolume snapshot /mnt/foo /mnt/hoge Create a snapshot of '/mnt/foo' in '/mnt/hoge' # ls /mnt/hoge/ bar baz # cat /mnt/hoge/bar bar # cat /mnt/hoge/baz baz #
snahshot • foo以下に適当にファイルを作る • fooのsnapshot作成 5 # echo bar >/mnt/foo/bar
# echo baz >/mnt/foo/baz # ls /mnt/foo/ bar baz # btrfs subvolume snapshot /mnt/foo /mnt/hoge Create a snapshot of '/mnt/foo' in '/mnt/hoge' # ls /mnt/hoge/ bar baz # cat /mnt/hoge/bar bar # cat /mnt/hoge/baz baz # “cp -r /mnt/foo /mnt/hoge”との違い • foo以下に大量のデータがあっても短 時間(多くはほぼ一瞬)で終わる • 追加容量をほぼ必要としない
btrfsのsnapshot作成が高速な理由を説明 • 初期状態 ◦ サブボリュームfooの下にbar,bazというファイルが存在する ◦ bar,bazはものすごく大きいとする (例: 数TiB) /
foo bazのメタデータ barのメタデータ barのデータ bazのデータ
fooのsnapshotであるhogeを作成すると… • barとbazを参照するhogeを作る • fooとhogeを参照するrootを作る / foo bazのメタデータ barのメタデータ barのデータ
bazのデータ / hoge
最後にrootを差し替え • これで終わり • barとbazには一切触っていないので高速 • 後でbarやbazを更新するときはメタデータ/データをCoWする / foo bazのメタデータ
barのメタデータ barのデータ bazのデータ / hoge
まとめ • Btrfsはbtrfs subvolume createコマンドでsubvolumeを使える • btrfs subvolume snapshotコマンドでsubvolumeのsnapshotを作成できる •
snapshotの利点 ◦ コピーに比べて高速で完了するし容量もほとんど消費しない ◦ readonlyでsnapshotを作成して、そのデータをコピーによりバックアップを作成するといった使い方 ができる ◦ かっこいい • snapshotの注意点(過去動画と一部同じ) ◦ データは冗長化されず、あくまで参照をコピーするだけなので、 snapshotそのものはバックアップに はならない ◦ snapshotを読み書き可能状態で作成すると後から使用量が CoWで予測しづらい形で増える ▪ ファイルの新規作成やファイルサイズの拡張をしていないのに使用量が増える 9