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
デバイス名は変わりうる
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Satoru Takeuchi
PRO
June 13, 2020
Technology
980
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
デバイス名は変わりうる
以下動画のテキストです。
https://youtu.be/Wl5wSXRPnxE
Satoru Takeuchi
PRO
June 13, 2020
Transcript
13 slides
デバイス名は変わりうる Jun 13th, 2020 Satoru Takeuchi Twitter: satoru_takeuchi 1
もくじ • 伝統的なデバイス名 • デバイス名は変わりうる • デバイス名の変化への対策 • まとめ 2
もくじ • 伝統的なデバイス名 • デバイス名は変わりうる • デバイス名の変化への対策 • まとめ 3
伝統的なデバイス名 • ブロックデバイスの伝統的な名前 ◦ HDD, SSD: /dev/sda, /dev/sdb… ◦ NVMe
SSD: /dev/nvm0n1, /dev/nvm0n2… ◦ VM上の準仮想化デバイス : /dev/vda, /dev/vdb... • TIPS ◦ ブロックデバイスの一覧表示 : lsblk ◦ ブロックデバイスの情報を得る : /sys/block/<名前>以下のファイルを見る • 主な用途: 起動時のマウント: /etc/fstab ◦ デバイス名ではなくUUIDというものを使っている。なぜ ? 4
もくじ • 伝統的なデバイス名 • デバイス名は変わりうる • デバイス名の変化への対策 • まとめ 5
デバイス名のつけかた • カーネルは起動時にデバイスの認識順に/dev/sda,/dev/sdb...と名前をつける 6 Disk A Disk B 最初に認識したから /dev/sda
Disk C 2番目に認識したから /dev/sdb 3番目に認識したから /dev/sdc
デバイス認識順が変わると… • デバイス名が変わってしまう ◦ この状態でdisk Cを初期化するつもりで dd if=/dev/zero of=/dev/sdcとすると死ぬ 7
Disk A Disk B 最初に認識したから /dev/sda Disk C 3番目に認識したから /dev/sdc 2番目に認識したから /dev/sdb
デバイス名が変わる典型例1: デバイスの故障 8 Disk A Disk B 最初に認識したから /dev/sda Disk
C 2番目に認識したから /dev/sdb 3番目に認識したから /dev/sdc Disk A Disk B 最初に認識したから /dev/sda Disk C 2番目に認識したから /dev/sdb 故障
演習 • やること: デバイス故障によってデバイス名が変更されることを確認 ◦ /dev/vda(ディスクA), /dev/vdb(ディスクB), /dev/vdc(ディスクC)がある仮想マシン環境を使う • 手順
1. 仮想マシン上で以下を確認 ▪ /dev/vdb(ディスクB)の先頭には”scratch1”という文字列データが入っている ▪ /dev/vdc(ディスクC)の先頭には”scratch2”という文字列データが入っている 2. 仮想マシンをシャットダウン 3. ディスクBを取り外す(故障のエミュレーション ) 4. 仮想マシンを再起動後 5. /dev/vdbの先頭に”scratch1”ではなく”scratch2”が入っていることを確認 9
もくじ 伝統的なデバイス名 デバイス名は変わりうる デバイス名の変化への対策 まとめ 10
代表的な対策 • Udevのpersistent device nameを使う ◦ Udevというサービスはデバイスを認識するごとに様々な別名をつけてくれる ▪ /dev/disk/by-uuid以下のファイル ▪
/dev/disk/by-label以下のファイル ▪ /dev/disk/by-path以下のファイル ◦ 詳細はarch wikiの”Persistent block device naming”のページなどを参照 • fstabには”UUID=”や”LABEL=”によるデバイス名指定もできる 11
もくじ 伝統的なデバイス名 デバイス名は変わりうる デバイス名の変化への対策 まとめ 12
まとめ • カーネルは起動時にディスク認識順に/dev/sda,/dev/sdbなどの名前をつける • 上記デバイス名は状況によって変わりうるのでfstabなどに指定するのは危険 • Udevのpersistent device nameなどをかわりに使う 13
More Decks by Satoru Takeuchi
See All by Satoru Takeuchi
119-多機能ファイルシステムBtrfs_のコピー.pdf
sat
PRO
1
84
Linuxカーネルの インタフェースは変わりうる?
sat
PRO
1
120
あなたの知らないバージョン命名規則
sat
PRO
3
940
Rook: Intro and Deep Dive with Ceph
sat
PRO
1
84
Machine Check Exception
sat
PRO
2
74
バイナリダンプの模様を読む
sat
PRO
0
120
cpコマンドはディスク上でデータを コピーしないことがある
sat
PRO
3
120
114-ファイルのshallow_copy.pdf
sat
PRO
2
73
113-Btrfsのスナップショット.pdf
sat
PRO
0
54
Other Decks in Technology
See All in Technology
Gifu WordPress Meetup #200 に向けて、私たちには何ができるだろうか?/ 2026-11-07 Gifu WordPress Meetup
torounit
0
250
うちなーぐちが認識できるなら、秋田弁もいけるはず!? Amazon Transcribe方言チューニング検証
ryouto715
1
160
Building Audio Plugin Ecosystem for Android in 2026
atsushieno
2
170
サボる子はいねぇがー!AgentCoreハーネスの脆弱性に学ぶ、エージェントの入力バリデーション
iwamot
PRO
5
320
The future of architectural work
ufried
0
200
思考過程から秘密が漏れる:Amazon Bedrock上のKimi K3を5つの方法で攻めたら、25回中22回漏洩した話
yama3133
1
130
Microsoft Entra Kerberos で実現するクラウド デバイス管理
tamaiyutaro
2
670
公共分野での生成AI活用
toru_kubota
1
320
プロダクションコードにおける encoding/json から encoding/json/v2 へのスムーズな移行
sansantech
PRO
1
360
The Author Pays
hiccupps
0
170
evcc & Home Assistant
naltatis
0
570
ライフワーク「猫でもわかるDirectConnect」
kentapapa
0
310
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
4 Signs Your Business is Dying
shpigford
187
23k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
460
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
Scaling GitHub
holman
464
140k
Building Applications with DynamoDB
mza
96
7.3k
Building an army of robots
kneath
307
47k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Heart Work Chapter 1 - Part 1
lfama
PRO
11
37k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
2
520
Speed Design
sergeychernyshev
33
2.2k