Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
lsblkのtypeフィールドのしくみ
Search
Satoru Takeuchi
PRO
October 03, 2023
Technology
2
190
lsblkのtypeフィールドのしくみ
以下動画のテキストです。
https://youtu.be/x_QSV1tM3qY
Satoru Takeuchi
PRO
October 03, 2023
Tweet
Share
More Decks by Satoru Takeuchi
See All by Satoru Takeuchi
KubeConにproposalを送りたい人へのアドバイス
sat
PRO
3
270
俺とキャンプ2
sat
PRO
1
99
俺とキャンプ3
sat
PRO
0
84
データ冗長化のしくみRAID 基礎概念とRAID1編
sat
PRO
2
33
RAIDの実現方法
sat
PRO
2
69
Linux環境のCPU上で10ミリ秒間に起こること
sat
PRO
3
110
HDDへのアクセス速度は位置によって変わる!??
sat
PRO
4
57
ボリュームマネージャLVM
sat
PRO
2
92
Best Practices of Production-Grade Rook/Ceph Cluster
sat
PRO
1
2k
Other Decks in Technology
See All in Technology
AWSに詳しくない人でも始められるコスト最適化ガイド
yuhta28
2
400
アクセス制御にまつわる改善 / Improving access control
itkq
0
590
止まらないLinuxシステムを構築する_高信頼性クラスタ入門
koedoyoshida
2
450
M5と自作基板をくっつけてみた〜M5 Japan Tour 2024 Spring 福冈 (Fukuoka|福岡)〜
keropiyo
0
150
Improve Your Development Workflow with Gemini Code Assist
meteatamel
0
130
M5stackで使用できるpHセンサの開発
shinrinakamura
0
190
AWS学習者向けにAzureの解説スライドを作成した話
handy
3
190
EM完全に理解した と思ったけど、 やっぱり何も分からなかった話 / EM Night Fukuoka #1
hirutas
0
280
認知症フレンドリーテックとスタックチャン
naokiuc
0
270
社内アプリで Cloudflare D1を プロダクト運用してみた体験談(Tokyo)
haochenx
0
120
自己改善からチームを動かす! 「セルフエンジニアリングマネージャー」のすゝめ
shoota
6
1k
VSCodeの拡張機能を作っている話
ebarakazuhiro
1
810
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
176
21k
Being A Developer After 40
akosma
66
580k
Mobile First: as difficult as doing things right
swwweet
217
8.6k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
26
2.3k
BBQ
matthewcrist
80
8.8k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
7
3.4k
Bootstrapping a Software Product
garrettdimon
PRO
302
110k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
22
1.6k
Why Our Code Smells
bkeepers
PRO
331
56k
Put a Button on it: Removing Barriers to Going Fast.
kastner
58
3.1k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
221
21k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
14
1.5k
Transcript
lsblkのtypeフィールドのしくみ Oct. 4th, 2023 Satoru Takeuchi twitter: satoru_takeuchi, EnSatoru 1
今回話すこと • lsblkというブロックデバイス一覧表示するコマンド • とくにtypeフィールドの値を決める方法 2
lsblkとは • ブロックデバイスについての色々な情報を得るためのコマンド 3
typeフィールド • ブロックデバイスの種類を表示 • 📝 過去動画「Linuxの色々なブロックデバイス」 4
ブロックデバイスの構成 5 sda (disk) sdb (disk) sdc (disk) sda1 (part)
sda2 part FAT32 filesystem ext4 filesystem testvg dm-0 (lvm) dm-1 (crypt) test.img loop0 (loop)
lsblkのソース • util-linuxの中にある • githubだとgithub.com/util-linux/util-linux • typeを判定しているのはmisc_utils/lsblk.c#get_type() 6
判定方法 • 基本は/sys/block以下のファイルを見る 7
kpartxコマンド • ディスクイメージなどの中のパーティションをブロックデバイスとして見えるようにす る • isoイメージの中のパーティションに作ったファイルシステムのmount時などによく使 う ◦ kpartx -a
test.img ◦ mount /dev/loop0p1 ◦ kpartx -d test.img 8
まとめ • ブロックデバイスの一覧を出すlsblkというコマンドがある • 出力の中のtypeフィールドはブロックデバイスの種類を示す • /sys/block以下の情報をもとに種類を識別している 9