编译lsblk工具,获取硬盘分区信息
程序员文章站
2022-06-12 17:11:21
...
1.修改configure文件
显示设定build_lsblk=yes,enable_lsblk=check
2.执行configure并make
./configure --disable-all-programs --enable-libblkid --enable-libmount --enable-libsmartcols
3.结果
0 17:19:53 .libs $ ldd ./lsblk
linux-vdso.so.1 (0x00007ffe6c3bd000)
libblkid.so.1 => ./libblkid.so.1 (0x00007f6caf625000)
libmount.so.1 => ./libmount.so.1 (0x00007f6caf5cb000)
libsmartcols.so.1 => ./libsmartcols.so.1 (0x00007f6caf594000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6caf3aa000)
/lib64/ld-linux-x86-64.so.2 (0x00007f6caf675000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f6caf3a0000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6caf37d000)
4.测试
0 18:03:43 .libs $ ./lsblk -o PATH,TYPE,FSTYPE,FSAVAIL,SIZE,MOUNTPOINT,LABEL
PATH TYPE FSTYPE FSAVAIL SIZE MOUNTPOINT LABEL
/dev/sda disk 465.8G
/dev/sda1 part 292.9M 300M /boot/efi
/dev/sda2 part 20G [SWAP]
/dev/sda3 part 60.9G 89.1G /
/dev/sda4 part 57.4G 178.2G /home
/dev/sda5 part 165.4G 178.2G /media/liuch/_dde_data3
因缺少udev的支持,所以FSTYPE和LABEL字段为空
上一篇: 针灸养生减肥适合的人群
下一篇: 爆笑的家庭生活糗事