查找连接到Linux机器的所有存储设备[已关闭](Find all storage devices attached to a Linux machine [closed])

编程入门 行业动态 更新时间:2024-10-27 19:14:51
查找连接到Linux机器的所有存储设备[已关闭](Find all storage devices attached to a Linux machine [closed])

我需要找到附加到给定机器的所有可写存储设备, 无论它们是否被安装。

这样做的方法是尝试 /dev中与可写设备( hd* and sd* )对应的每个条目......

有没有更好的解决方案,还是应该坚持这个?

I have a need to find all of the writable storage devices attached to a given machine, whether or not they are mounted.

The dopey way to do this would be to try every entry in /dev that corresponds to a writable devices (hd* and sd*)......

Is there a better solution, or should I stick with this one?

最满意答案

/proc/partitions将列出系统识别的所有块设备和分区。 然后,您可以尝试使用file -s <device>来确定分区上存在哪种文件系统(如果有的话)。

/proc/partitions will list all the block devices and partitions that the system recognizes. You can then try using file -s <device> to determine what kind of filesystem is present on the partition, if any.

更多推荐

本文发布于:2023-08-01 18:33:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1363619.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:连接到   存储设备   机器   Linux   Find

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!