磁盘使用

设备系统为linux ubuntu20,当插入 U 盘或者 TF 卡,存储设备也会被识别为 /dev/sdb1 或 /dev/mmcblkp1 类似节点,与桌面 PC Linux 环境下相同。

正常u盘插入,会被自动挂载到/media/usb-sd*目录,可以使用 df -h 命令查看是否有挂载:

linaro@bm1684:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
overlay         5.9G  788M  4.8G  14% /
devtmpfs        3.4G     0  3.4G   0% /dev
tmpfs           3.4G     0  3.4G   0% /dev/shm
tmpfs           692M  1.8M  690M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.4G     0  3.4G   0% /sys/fs/cgroup
/dev/mmcblk0p1  128M   65M   64M  51% /boot
/dev/mmcblk0p7   44G  300K   42G   1% /data
/dev/mmcblk0p4  2.4G  2.3G     0 100% /media/root-ro
/dev/mmcblk0p5  5.9G  788M  4.8G  14% /media/root-rw
/dev/mmcblk0p6  2.0G  159M  1.7G   9% /opt
/dev/mmcblk0p2  2.9G   53M  2.8G   2% /recovery
tmpfs           692M     0  692M   0% /run/user/1000
/dev/sda         30G   80K   30G   1% /media/usb-sda

如果未被自动挂载,比如tf卡插入时,可以使用 sudo fdisk -l 命令,查看对应的节点:

linaro@bm1684:~$ sudo fdisk -l
...
Disk /dev/sda: 29.3 GiB, 31457280000 bytes, 61440000 sectors
Disk model: U330
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: 0x00000000


Disk /dev/mmcblk1: 29.74 GiB, 31914983424 bytes, 62333952 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: 0x00000000

Device         Boot Start      End  Sectors  Size Id Type
/dev/mmcblk1p1       8192 62333951 62325760 29.7G  c W95 FAT32 (LBA)

可以看到tf卡节点为 /dev/mmcblk0p1 , 则可以使用 mount /dev/mmcblk0p1 /mnt 命令将其挂载到/mnt目录。