一、文件位置
通过df -h file
获取块设备文件存放位置sdb4,sudo fdisk -l
获取sdb4在/dev/sdb磁盘文章来源:https://www.toymoban.com/news/detail-633507.html
touch test
df -h test
#-------------------------------------------------------------
Filesystem Size Used Avail Use% Mounted on
/dev/sdb4 59G 27M 59G 1% /media/ubuntu/7F74-11C0
#-------------------------------------------------------------
sudo fdisk -l
#-------------------------------------------------------------
Disk /dev/sdb: 58.6 GiB, 62914560000 bytes, 122880000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xcad4ebea
Device Boot Start End Sectors Size Id Type
/dev/sdb4 * 256 122879999 122879744 58.6G c W95 FAT32 (LBA)
#-------------------------------------------------------------
二、磁盘信息(方法一)
lshw
获得sdb磁盘为usb类型,capabilities
属性指示为模拟设备(示例为虚拟机,真实设备为Removable)文章来源地址https://www.toymoban.com/news/detail-633507.html
sudo lshw -class disk -class storage
#-----------------------------------------------------------------------------------
*-usb
description: Mass storage device
vendor: HIKSEMI
physical id: 1
bus info: usb@4:1
logical name: scsi33
version: 1.10
serial: ZL230324000106
capabilities: usb-3.20 scsi emulated scsi-host
configuration: driver=usb-storage maxpower=304mA speed=5000Mbit/s
*-disk
description: SCSI Disk
physical id: 0.0.0
bus info: scsi@33:0.0.0
logical name: /dev/sdb
size: 58GiB (62GB)
capabilities: partitioned partitioned:dos
configuration: logicalsectorsize=512 sectorsize=512 signature=cad4ebea
#-----------------------------------------------------------------------------------
三、设备属性(方法二)
cd /sys/class/block/sdb # 或cd /sys/block/sdb
cat removable
# 1 可移动设备
四、磁盘链接(方法三,仅限USB)
ls -l /dev/disk/by-id/usb*
#------------------------------------------------------
lrwxrwxrwx 1 root root 9 Aug 7 20:39 /dev/disk/by-id/usb-HIKSEMI__ZL230324000106-0:0 -> ../../sdb
lrwxrwxrwx 1 root root 10 Aug 7 20:39 /dev/disk/by-id/usb-HIKSEMI__ZL230324000106-0:0-part4 -> ../../sdb4
#------------------------------------------------------
到了这里,关于Linux判断文件存储移动磁盘的方法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!