本文介绍了SD卡读卡器通过usb连接到树莓派的挂载和卸载的操作,以及SD卡的格式化以及查看SD卡容量的命令行操作。mount umount mkfs.vfat df

当SD卡插入到树莓派板子上的时候/dev目录下会出现sda1的设备节点,有时候会出现sdb1或者sdc1设备节点。有的Linux系统上是mmcblk*的设备节点,可能和操作系统有关,也有可能是笔者连接SD卡的方式是通过一个USB hub的tf读卡器的原因。

sudo fdisk -l

值得注意的是:在系统一直运行中的时候,第一次插上SD卡,显示的是sda1,然后插拔SD卡后变成sdb1,再次插拔SD卡后变成sdc1,继续插拔SD卡,就一直是sdc1了。这可能和树莓派的系统有关,就是只能识别3个SD卡接入。reboot系统后,发现,不管SD卡热插拔多少次显示的设备节点都是sda1,在没有插SD卡时/dev目录只有sda设备节点。所以上面出现的sdb1和sdc1 可能是随机的。

SD卡的挂载:

sudo mkdir /mnt/sdcard

sudo mount -t vfat /dev/sda1 /mnt/sdcard/

因为是Windows分区,所以是vfat文件系统格式

mount -t vfat -o iocharset=utf8 /dev/sdb1 /mnt/usb/

指定中文编码格式为UTF-8

(经过上的挂载操作后发现:挂载成功后,将SD卡拔出,sudo fdisk -l下面没有sda1了,但是dev目录下仍然有sda1,查看/mnt/sdcard目录,文件仍然存在)

SD卡的卸载:

umount -v /mnt/sdcard/

SD卡的格式化操作:

1.从Linux中卸载SD卡

sudo umount -v /mnt/sdcard/

如果没有这一步操作:在格式化的时候就会出现如下错误:

pi@raspberrypi:/mnt/sdcard $ sudo mkfs.vfat /dev/sda1

mkfs.fat 4.1 (2017-01-24)

mkfs.vfat: /dev/sda1 contains a mounted filesystem.

pi@raspberrypi:/mnt/sdcard $

2.格式化SD卡

sudo mkfs.vfat /dev/sda1

3.重新挂载SD卡

sudo mount -t vfat /dev/sda1 /mnt/sdcard/

查看SD卡的总的容量和已使用过的容量以及剩余可以使用的容量

df -h /dev/sda1

pi@raspberrypi:~ $ mount -h

Usage:

mount [-lhV]

mount -a [options]

mount [options] [--source] | [--target] mount [options] mount []

Mount a filesystem.

Options:

-a, --all mount all filesystems mentioned in fstab

-c, --no-canonicalize don't canonicalize paths

-f, --fake dry run; skip the mount(2) syscall

-F, --fork fork off for each device (use with -a)

-T, --fstab alternative file to /etc/fstab

-i, --internal-only don't call the mount.helpers

-l, --show-labels show also filesystem labels

-n, --no-mtab don't write to /etc/mtab

--options-mode what to do with options loaded from fstab

--options-source mount options source

--options-source-force

force use of options from fstab/mtab

-o, --options comma-separated list of mount options

-O, --test-opts limit the set of filesystems (use with -a)

-r, --read-only mount the filesystem read-only (same as -o ro)

-t, --types limit the set of filesystem types

--source explicitly specifies source (path, label, uuid)

--target explicitly specifies mountpoint

-v, --verbose say what is being done

-w, --rw, --read-write mount the filesystem read-write (default)

-N, --namespace perform mount in another namespace

-h, --help display this help

-V, --version display version

Source:

-L, --label synonym for LABEL=-U, --uuid synonym for UUID=LABEL=specifies device by filesystem label

UUID=specifies device by filesystem UUID

PARTLABEL=specifies device by partition label

PARTUUID=specifies device by partition UUID

specifies device by path

mountpoint for bind mounts (see --bind/rbind)

regular file for loopdev setup

Operations:

-B, --bind mount a subtree somewhere else (same as -o bind)

-M, --move move a subtree to some other place

-R, --rbind mount a subtree and all submounts somewhere else

--make-shared mark a subtree as shared

--make-slave mark a subtree as slave

--make-private mark a subtree as private

--make-unbindable mark a subtree as unbindable

--make-rshared recursively mark a whole subtree as shared

--make-rslave recursively mark a whole subtree as slave

--make-rprivate recursively mark a whole subtree as private

--make-runbindable recursively mark a whole subtree as unbindable

For more details see mount(8).

pi@raspberrypi:~ $ umount -h

Usage:

umount [-hV]

umount -a [options]

umount [options] | Unmount filesystems.

Options:

-a, --all unmount all filesystems

-A, --all-targets unmount all mountpoints for the given device in the

current namespace

-c, --no-canonicalize don't canonicalize paths

-d, --detach-loop if mounted loop device, also free this loop device

--fake dry run; skip the umount(2) syscall

-f, --force force unmount (in case of an unreachable NFS system)

-i, --internal-only don't call the umount.helpers

-n, --no-mtab don't write to /etc/mtab

-l, --lazy detach the filesystem now, clean up things later

-O, --test-opts limit the set of filesystems (use with -a)

-R, --recursive recursively unmount a target with all its children

-r, --read-only in case unmounting fails, try to remount read-only

-t, --types limit the set of filesystem types

-v, --verbose say what is being done

-q, --quiet suppress 'not mounted' error messages

-N, --namespace perform umount in another namespace

-h, --help display this help

-V, --version display version

For more details see umount(8).

linux读取树莓派SD卡,树莓派系统(Linux)SD卡存储设备的命令行使用相关推荐

  1. 在Linux环境下用C语言编写一个乘法程序mult,从命令行接收两个数字,然后输出其乘积;再用C语言编写一个exec1程序,在程序中使用execvp调用mult程序计算5与10的乘积。

    在Linux环境下用C语言编写一个乘法程序mult,从命令行接收两个数字,然后输出其乘积:再用C语言编写一个exec1程序,在程序中使用execvp调用mult程序计算5与10的乘积. 1.mult. ...

  2. 号卡推广系统,号卡代理系统,原创号卡系统

    [标题:号卡推广系统助力号卡代理业务的发展] 随着移动通信技术的飞速发展,手机已经成为人们生活中不可或缺的一部分.而号卡推广系统作为一个能够帮助号卡代理商快速搭建号卡销售平台的工具,正变得越来越受欢迎 ...

  3. 将windows系统装到USB存储设备

    将windows系统装到USB存储设备 需求: 1)一般公司比较规范,计算机系统有严格的限制策略,如果自己不懂得如何更改或者没有权限更改,将极其不便. 2)计划在家里完成在公司未完成的事,甚至异地出差 ...

  4. 树莓派安装图形化桌面系统及SD卡恢复方法

    1.下载树莓派映像文件: 下载地址:http://www.raspberrypi.org/downloads Raspbian系统是树莓派官方推荐的系统 第一种是点击下面的NOOBS,下载压缩包解压缩 ...

  5. 在Windows和Linux系统上,用C语言实现命令行下输入密码回显星号和完全隐藏密码

    本篇目录 引子 在Windows 上实现 在Linux上实现 回显星号 代码解读 运行 完全隐藏 运行 引子 在Windows系统上,当我们使用命令行和MySQL进行交互时,第一步就是要输入密码: - ...

  6. linux内核分成如下五个子系统,linux内核主要由5个子系统 Linux内核由哪几个子系统组成?...

    1, Linux内核由哪几个子系统组成? Linux内核主要由五个子系统组成:进程调度,内存管理,虚拟文件系统,网络接口,进程间通信.1.进程调度(SCHED):控制进程对CPU的访问.当需要选择下一 ...

  7. linux镜像使用什么pe安装系统,Linux系统ISO镜像文件可不可以用pe启动盘来安装

    2017-10-28 回答 首先:你的问题描述不清楚.可理解 为c盘无系统,win系统在d或者e盘,想把linux装在c盘.其次:如果你想学习fedora系统得话建议去fedora官网下载安装指南,以 ...

  8. 树莓派2(Raspberry pi)取消 usb 存储设备的自动挂载

    自从入手树莓派后,一直都在被树莓派的USB设备自动挂载问题所困扰,这个自动挂载的起因是GNOME图形化界面组件里自带了这个功能.那么我们如何在树莓派中取消这项功能呢?国内关于自动挂载问题,无外乎就是去 ...

  9. 【Android NDK 开发】NDK 交叉编译 ( NDK 函数库目录 | Linux 交叉编译环境搭建 | 指定头文件目录 | 指定函数库目录 | 编译 Android 命令行可执行文件 )

    文章目录 I . NDK platforms 目录下的 函数库 II . Ubuntu 配置 NDK 交叉编译环境 III . 同时指定编译的头文件和库文件 IV . 指定编译的头文件 V . 指定编 ...

最新文章

  1. Redis : redis事务
  2. UC上云 为网络大型游戏保驾护航
  3. 微软拿下美国国防部100亿美元云合同,亚马逊不干了...
  4. mybatis集成 c3p0数据源
  5. flush privileges提示Table 'mysql.servers' doesn't exist解决办法
  6. 微博api unexpected response status: 403_抖音直播监控Api:开播查询
  7. nvidia-smi 重置GPU
  8. 小白必看的经典机器学习入门项目
  9. 2020 IJCAI 接受论文 list 分类排列(三)
  10. 有没有不用加班的程序员?如何衡量程序员的工作量?
  11. exchange创建邮箱组_在 Exchange Server 中创建用户邮箱
  12. ubuntu16.04 安装为知笔记
  13. Java Web 开发后续(二)
  14. 关于SASE与安全市场的那些事
  15. 决战面试(二)智力题考察
  16. oracle主键必须加分区字段,oracle分区表和主键关系
  17. Dream it possible-我的2016
  18. python一个整数,它加上100后是一个完全平方数,再加上168又是一个完全平方数,请问该数是多少?
  19. 双11了,漂亮灵气仙气十足的小姐姐想脱单,广东惠州人,大专学历财务工作,性格温和(NO.001)...
  20. android edittext禁止输入特殊字符,禁止输入表情以及特殊字符方法

热门文章

  1. ECU 自动化生产测试系统【案例篇】
  2. 风火编程--python获取单只股票实时数据和历史数据
  3. 中健长生露祝贺中国奥运健儿东京凯旋
  4. 简易电压表(51)教程
  5. 518超市播音软件如何放大音量到150的,传统播音软件声音太小(0-100)
  6. thinkphp对接易联云打印
  7. Linux 远程复制文件和目录
  8. linux nkf 日文编码转换命令[转载]
  9. 关于Linux性能调优中磁盘IO调优的一些笔记
  10. 621c语言与web技术真题,2018年南京师范大学教育科学院621C语言与WEB技术之C程序设计考研核心题库...