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
540
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
Rook: Intro and Deep Dive With Ceph
sat
PRO
1
100
会社員しながら本を書いてきた知見の共有
sat
PRO
3
770
デバイスにアクセスするデバイスファイル
sat
PRO
1
33
ファイルシステムのデータを ブロックデバイスへの操作で変更
sat
PRO
1
29
デバイスドライバ
sat
PRO
0
45
マルチスレッドの実現方法 ~カーネルスレッドとユーザスレッド~
sat
PRO
2
120
共有メモリ
sat
PRO
3
67
マルチスレッドプログラム
sat
PRO
3
56
Linuxのブートプロセス initramfs編
sat
PRO
2
81
Other Decks in Technology
See All in Technology
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
26k
Microsoft Build 2025 技術/製品動向 for Microsoft Startup Tech Community
torumakabe
2
320
Oracle Cloud Infrastructure:2025年6月度サービス・アップデート
oracle4engineer
PRO
2
310
フィンテック養成勉強会#54
finengine
0
200
Oracle Audit Vault and Database Firewall 20 概要
oracle4engineer
PRO
3
1.7k
なぜ私はいま、ここにいるのか? #もがく中堅デザイナー #プロダクトデザイナー
bengo4com
0
1.2k
Node-RED × MCP 勉強会 vol.1
1ftseabass
PRO
0
170
2025-06-26_Lightning_Talk_for_Lightning_Talks
_hashimo2
2
110
Witchcraft for Memory
pocke
1
640
MySQL5.6から8.4へ 戦いの記録
kyoshidaxx
1
290
変化する開発、進化する体系時代に適応するソフトウェアエンジニアの知識と考え方(JaSST'25 Kansai)
mizunori
1
260
生成AI開発案件におけるClineの業務活用事例とTips
shinya337
0
150
Featured
See All Featured
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
281
13k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
48
5.4k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
Visualization
eitanlees
146
16k
Balancing Empowerment & Direction
lara
1
390
Done Done
chrislema
184
16k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
940
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Docker and Python
trallard
44
3.4k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
How GitHub (no longer) Works
holman
314
140k
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