RK3568 Debian10 固态硬盘自动挂载

2023-11-12

Platform: RK3568
OS: Debian10
Kernel: v4.19.219
Module: Wdxsky SSD NVME 950 128G


需求

开机启动时自动挂载ssd固态硬盘。

实现

编辑/etc/fstab文件

# <file system>                 <mount pt>              <type>          <options>               <dump>  <pass>
/dev/nvme0n1p1          /media/linaro/ssd        auto        defaults,nofail,x-systemd.device-timeout=1,noatime        0       0

步骤

  1. 我们的ssd固态硬盘是pcie nvme接口的,kernel层先配置好pcie节点属性,之后确认设备可识别

    root@linaro-alip:~# ls /dev/nvme0n1p1 
    /dev/nvme0n1p1
    
  2. 打开Debian的文件管理器File Manager PCManFM,发现左侧快捷栏已识别到盘符,点击会提示需要输入用户密码,之后便可挂载成功,从以下df命令的结果可以看出是挂载到了/media/linaro/2803-1B06 目录

    root@linaro-alip:~# df -h
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/root       3.4G  2.5G  750M  78% /
    devtmpfs        978M  8.0K  978M   1% /dev
    tmpfs           986M   10M  976M   2% /dev/shm
    tmpfs           986M   17M  969M   2% /run
    tmpfs           5.0M  4.0K  5.0M   1% /run/lock
    tmpfs           986M     0  986M   0% /sys/fs/cgroup
    tmpfs           198M  8.0K  198M   1% /run/user/1000
    tmpfs           198M     0  198M   0% /run/user/0
    /dev/mmcblk0p8  8.3G  3.8M  8.3G   1% /media/linaro/9d85d337-9d03-4448-b4bd-4b399230974e
    /dev/mmcblk0p7  126M   13M  107M  11% /media/linaro/9cda8ba9-2cbe-4382-83b3-61a2c34adc92
    /dev/nvme0n1p1  120G  2.5G  117G   3% /media/linaro/2803-1B06
    
  3. 想要实现自动挂载,不需要输入密码确认,则可通过修改/etc/fstab文件来实现。一开始没想太多,参考网上的资料12,进行如下默认配置,就可以实现自动挂载功能了

    # <file system>			<mount pt>		<type>		<options>		<dump>	<pass>
    /dev/nvme0n1p1          /mnt/ssd        auto        defaults        0       0
    

    该挂载点是在/mnt/ssd 目录,实测发现在文件管理器中此目录没有快捷显示,要经多次点击打开对应目录才能看到ssd的内容,用起来不够便捷,应该还可以继续优化。

  4. 参考快捷显示的路径,新建一个/media/linaro/ssd目录进行挂载,经验证可以在快捷栏显示出来。满以为这就大功告成了,后来发现有个大问题,当没有连接ssd时上电启动进不了系统,会卡死在logo界面。主要报错信息如下:

    [  OK  ] Started Load/Save RF Kill Switch Status.
    [    4.266069] rk-pcie 3c0800000.pcie: PCIe Linking... LTSSM is 0x0
    [    5.279411] rk-pcie 3c0800000.pcie: PCIe Linking... LTSSM is 0x0
    [    6.292739] rk-pcie 3c0800000.pcie: PCIe Linking... LTSSM is 0x1
    [    7.306069] rk-pcie 3c0800000.pcie: PCIe Linking... LTSSM is 0x0
    [    8.319409] rk-pcie 3c0800000.pcie: PCIe Linking... LTSSM is 0x0
    [*     ] (1 of 2) A start job is running for… Time Synchronized (5s / no limit)
    [***   ] (1 of 2) A start job is running for… Time Synchronized (6s / no limit)
    [   ***] (2 of 2) A start job is running for /dev/nvme0n1p1 (9s / 1min 30s)
    [   11.359404] rk-pcie 3c0800000.pcie: PCIe Link Fail
    [  *** ] (2 of 2) A start job is running for /dev/nvme0n1p1 (29s / 1min 30s)
    [   32.052777] vcc5v0_otg: disabling
    [   32.052808] vcc3v3_lcd0_n: disabling
    [   32.052821] vcc3v3_lcd1_n: disabling
    [ ***  ] (2 of 2) A start job is running for…ev/nvme0n1p1 (1min 15s / 1min 30s)  
    ......
    [ TIME ] Timed out waiting for device /dev/nvme0n1p1.
    [DEPEND] Dependency failed for /media/linaro/ssd.
    [DEPEND] Dependency failed for Local File Systems.
             Starting Set console font and keymap...
             Starting Raise network interfaces...
             Starting Enable support fo…l executable binary formats...
    [  OK  ] Stopped Forward Password R…uests to Wall Directory Watch.
    [  OK  ] Reached target Sound Card.
    [  OK  ] Stopped Dispatch Password …ts to Console Directory Watch.
    [  OK  ] Reached target Login Prompts.
    [  OK  ] Reached target Timers.
    [  OK  ] Reached target Paths.
             Starting Create Volatile Files and Directories...
    [  OK  ] Closed Syslog Socket.
    [  OK  ] Started Emergency Shell.
    [  OK  ] Reached target Emergency Mode.
    [  OK  ] Reached target Sockets.
    [  OK  ] Started Set console font and keymap.
    [  OK  ] Started Enable support for…nal executable binary formats.
    [  OK  ] Started Create Volatile Files and Directories.
             Starting Network Time Synchronization...
             Starting Update UTMP about System Boot/Shutdown...
             Starting Network Name Resolution...
    [  OK  ] Started Update UTMP about System Boot/Shutdown.
             Starting Update UTMP about System Runlevel Changes...
    [  OK  ] Started Raise network interfaces.
    [  OK  ] Started Update UTMP about System Runlevel Changes.
    [  OK  ] Started Network Time Synchronization.
    [  OK  ] Started Network Name Resolution.
    [  OK  ] Reached target Host and Network Name Lookups.
    [  OK  ] Reached target Network.
    You are in emergency mode. After logging in, type "journalctl -xb" to view
    system logs, "systemctl reboot" to reboot, "systemctl default" or "exit"
    to boot into default mode.
    
    Cannot open access to console, the root account is locked.
    See sulogin(8) man page for more details.
    
    Press Enter to continue.
    

    从打印上看应该是系统没识别到nvme设备时先会进行1min30s的等待,timeout之后就进入了emergency mode。

  5. 我们的需求肯定是有连接ssd设备时自动挂载,没有连接时也不影响系统正常启动。继续查阅资料3,发现可以在< options > 中加上nofail选项来解决,该选项设置后外部设备在插入时可挂载,在未插入时忽略错误正常启动。该选项通常会结合x-systemd.device-timeout 来使用4,表示等待该设备多长时间才认为可用于挂载(即判断该设备可执行挂载操作),默认等待90s。而noatime选项则表示不更新文件系统上 inode 访问次数,有助于提升性能5。添加以上选项后测试不论有没有外接ssd均不影响系统正常启动,验证成功。

附录

附上fstab文件的基本格式与用法说明6,对于外挂的硬盘,主要就是要写明文件系统,挂载目录,文件系统类型,然后根据需要设置< optinos >选项,最后< dump >和< pass >一般都填0就好。

The fstab (/etc/fstab) (or file systems table) file is a system configuration file on Debian systems. The fstab file typically lists all available disks and disk partitions, and indicates how they are to be initialized or otherwise integrated into the overall system’s file system.

Example

# <file system>        <dir>         <type>    <options>             <dump> <pass>
/dev/sda1              /             ext4      defaults              1      1
/dev/hdxx              /usr          ext4      defaults              1      1
/dev/sda5              swap          swap      defaults              0      0

It is not necessary to list /proc and /sys in the fstab unless some special options are needed. The boot system will always mount them.

Field definitions

/etc/fstab contains the following fields separated by a space or tab:

<file system>   <dir>   <type>  <options>       <dump>  <pass>
  • - defines the storage device (i.e. /dev/sda1).

  • - tells the mount command where it should mount the to.

  • - defines the file system type of the device or partition to be mounted. Many different file systems are supported. Some examples are: ext2, ext3, reiserfs, xfs, jfs, smbfs, iso9660, vfat, ntfs, swap, and auto. The ‘auto’ type lets the mount command to attempt to guess what type of file system is used, this is useful for removable devices such as CDs and DVDs.

  • - define particular options for filesystems. Some options relate only to the filesystem itself. Some of the more common options are:

    • auto - file system will mount automatically at boot, or when the command ‘mount -a’ is issued.
    • noauto - the filesystem is mounted only when you tell it to.
    • exec - allow the execution binaries that are on that partition (default).
    • noexec - do not allow binaries to be executed on the filesystem.
    • ro - mount the filesystem read only.
    • rw - mount the filesystem read-write.
    • sync - I/O should be done synchronously.
    • async - I/O should be done asynchronously.
    • flush - specific option for FAT to flush data more often, thus making copy dialogs or progress bars to stays up until things are on the disk.
    • user - permit any user to mount the filesystem (implies noexec,nosuid,nodev unless overridden).
    • nouser - only allow root to mount the filesystem (default).
    • defaults - default mount settings (equivalent to rw,suid,dev,exec,auto,nouser,async).
    • suid - allow the operation of suid, and sgid bits. They are mostly used to allow users on a computer system to execute binary executables with temporarily elevated privileges in order to perform a specific task.
    • nosuid - block the operation of suid, and sgid bits.
    • noatime - do not update inode access times on the filesystem. Can help performance.
    • nodiratime - do not update directory inode access times on the filesystem. Can help performance. You do not need to enable this flag if you have already enabled noatime.
    • relatime - update inode access times relative to modify or change time. Access time is only updated if the previous access time was earlier than the current modify or change time (similar to noatime, but doesn’t break mutt or other applications that need to know if a file has been read since the last time it was modified). Can help performance.
  • - is used by the dump utility to decide when to make a backup. When installed, dump checks the entry and uses the number to decide if a file system should be backed up. Possible entries are 0 and 1. If 0, dump will ignore the file system, if 1, dump will make a backup. Most users will not have dump installed, so they should put 0 for the entry.

  • fsck reads the number and determines in which order the file systems should be checked. Possible entries are 0, 1, and 2. The root file system should have the highest priority, 1, all other file systems you want to have checked should get a 2. File systems with a value 0 will not be checked by the fsck utility.


欢迎留言讨论,感谢阅读~

参考资料


  1. etc fstab 详解linux,/etc/fstab功能详解 ↩︎

  2. linux之fstab文件详解 ↩︎

  3. 浅析fstab与移动硬盘挂载方法 ↩︎

  4. systemd时代的/etc/fstab ↩︎

  5. 使用noatime提升文件系统性能 ↩︎

  6. fstab ↩︎

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

RK3568 Debian10 固态硬盘自动挂载 的相关文章

  • 如何让 PHP、符号链接和 __FILE__ 很好地协同工作?

    在本地主机上 我有以下目录结构 share www trunk wp content plugins otherfolders share www portfolio wp content symlink Where symlink是一个符
  • libusb 和轮询/选择

    我正在使用 Linux 操作系统 想知道是否有任何文件描述符可以轮询 选择 当数据等待从 USB 设备读取时会触发这些文件描述符 我也在使用 libusb 库 但尚未找到可以使用的文件描述符 Use libusb 的轮询函数 http li
  • 使用 gatttool 或 bluepy BLE 订阅通知

    我正在使用 bluepy 编写一个程序 用于监听蓝牙设备发送的特征 我还可以使用任何库或语言 唯一的限制是在 Linux 上运行 而不是在移动环境中运行 似乎仅在移动设备中广泛使用 没有人在桌面上使用 BLE 使用 bluepy 我注册了委
  • 让“git pull”在拉取不同分支时要求确认

    当同时处理许多项目和分支时 我偶尔会犯一些愚蠢的错误 比如拉入错误的分支 例如在分支上master I did git pull origin dangerous code并且有一段时间没有注意到这一点 这个小错误造成了很大的混乱 当我尝试
  • 如何随时暂停 pthread?

    最近我开始将 ucos ii 移植到 Ubuntu PC 上 我们知道 在pthread的回调函数中的 while 循环中简单地添加一个标志来执行暂停和恢复是不可能模拟ucos ii中的 进程 的 如下解决方案 因为ucos ii中的 进程
  • 使用 linux perf 工具测量应用程序的 FLOP

    我想使用 perf Linux 性能计数器子系统的新命令行接口命令 来测量某些应用程序执行的浮点和算术运算的数量 出于测试目的 我使用了我创建的一个简单的虚拟应用程序 请参见下文 因为我找不到任何为测量 FP 和整数运算而定义的 perf
  • 如何修改s_client的代码?

    我正在玩apps s client c in the openssl源代码 我想进行一些更改并运行它 但是在保存文件并执行操作后 我的更改没有得到反映make all or a make 例如 我改变了sc usage函数为此 BIO pr
  • 操作系统崩溃的常见原因[关闭]

    Closed 这个问题需要多问focused help closed questions 目前不接受答案 我有兴趣了解 操作系统崩溃 不限于Windows崩溃 最常见的技术原因 从操作系统编程的角度 有哪些 我正在寻找一个不像 打开太多应用
  • 即使 makefile 和源代码存在,为什么“Build Project”在 Eclipse Helios CDT 中显示为灰色?

    我无法构建我的项目 我在 Eclipse Helios 中创建了一个新的 CDT 项目 并告诉它使用现有的源代码和 makefile 这两者都正确显示在 Package 和 Project 视图中 然而 项目 菜单中的 构建全部 和 构建项
  • Nasm 打印到下一行

    我用 nasm Assembly 编写了以下程序 section text global start start Input variables mov edx inLen mov ecx inMsg mov ebx 1 mov eax 4
  • 使用 C++ 输出字符串覆盖 Linux 终端上的最后一个字符串

    假设我有一个命令行程序 有没有办法让我说的时候 std cout lt lt stuff 如果我不做std cout lt lt n 在另一个之间std cout lt lt stuff 东西的另一个输出将覆盖同一行上的最后一个东西 清理行
  • 变量作为 bash 数组索引?

    bin bash set x array counter 0 array value 1 array 0 0 0 for number in array do array array counter array value array co
  • ARM 系统调用的接口是什么?它在 Linux 内核中的何处定义?

    我读过有关 Linux 中的系统调用的内容 并且到处都给出了有关 x86 架构的描述 0x80中断和SYSENTER 但我无法追踪 ARM 架构中系统调用的文件和进程 任何人都可以帮忙吗 我知道的几个相关文件是 arch arm kerne
  • 将 stdout 作为命令行 util 的文件名传递?

    我正在使用一个命令行实用程序 该实用程序需要传递文件名以将输出写入 例如 foo o output txt 它唯一写入的东西stdout是一条消息 表明它运行成功 我希望能够通过管道传输写入的所有内容output txt到另一个命令行实用程
  • gnome-terminal 新选项卡,使用别名作为要执行的命令

    我已经创建了一个别名 bashrc文件如下 alias myproject cd Desktop myproject 当我重新启动终端时保存文件后 输入myproject带我到项目目录 但是当我尝试使用别名作为新的命令参数时gnome te
  • 通过 SSH 将变量传递给远程脚本

    我正在通过 SSH 从本地服务器在远程服务器上运行脚本 首先使用 SCP 复制该脚本 然后在传递一些参数时调用该脚本 如下所示 scp path to script server example org another path ssh s
  • 如何在 Linux 中使用单行命令获取 Java 版本

    我想通过单个命令获取 Linux 中的 Java 版本 我是 awk 的新手 所以我正在尝试类似的事情 java version awk print 3 但这不会返回版本 我将如何获取1 6 0 21从下面的Java版本输出 java ve
  • 如何在两个不同帐户之间设置无密码身份验证

    我们可以在两台机器的两种不同用途之间设置无密码身份验证吗 例如 计算机A有用户A 计算机B有用户B 我们可以设置密码 ssh 以便计算机 A 上的用户 A 使用其用户帐户 A 登录计算机 B 谢谢你 如果我理解你的问题 你能设置一下吗ssh
  • 如何使用ffmpeg重叠和合并多个音频文件?

    我正在尝试将多个音频文件合并到一个文件中 但我可以使用以下命令来连接 而不是连接 ffmpeg v debug i file1 wav i file2 wav i file3 wav filter complex 0 0 concat n
  • 远程linux服务器到远程linux服务器大型稀疏文件复制 - 如何?

    我有两台 CentOS 5 4 服务器 每台服务器上都安装了 VMware Server 假设我始终对 vmware 虚拟机使用稀疏文件 将虚拟机文件从一台服务器复制到另一台服务器的最可靠 最快速的方法是什么 虚拟机的文件复制起来很痛苦 因

随机推荐

  • JAVA小练习149——需求: 一家三口都要工作, 儿子工作负责绘画, 妈妈可以在儿子的工作上进行增强---上涂料, 爸爸的工作就是在妈妈的基础上增强---上画框

    interface Work public void work class Son implements Work Override public void work System out println 在画画 class Mother
  • python实践:让所有奇数都在偶数前面,而且奇数升序排列,偶数降序排序

    给定一个任意长度数组 实现一个函数 让所有奇数都在偶数前面 而且奇数升序排列 偶数降序排序 如字符串 1982376455 变成 1355798642 class Solution def SortNum self num list par
  • js查找数组重复元素

    方法一 利用sort方法 先使用sort方法将数组排序 再来判断找出重复元素 function res arr var temp arr sort sort function a b if a b temp indexOf a 1 temp
  • 数值分析复习笔记-第七章-非线性方程求根

    Chapter7 非线性方程求根 7 1 前言 本质 对一些n次代数多项式or超越方程 它们的根是难以通过解析方法求得 因此需采取数值方法 主要有 二分法 不动点迭代法 迭代加速 牛顿迭代法 牛顿法 割线法 7 2 二分法 数学基础 零点定
  • 多边形等分算法

    多边形等分
  • Python基础-- 9函数(中)

    一 函数的返回值 返回值就是函数执行以后返回的结果 通过return来指定函数的返回值 return后面可以跟任意对象 返回值甚至可以是 个函数 二 文档字符串 在定义函数时 可以在函数内部编写文档字符串 文档字符串就是对函数的 说明 he
  • Linux中TAB补全显示设备空间不足问题

    今天在使用linux中习惯性的使用tab键进行补全信息 发现无论在何处按下tab都会显示这样报错 图中因为我用了xshell工具 这里报错是中文的 这个时候要检查下自己的空间是否充足 可使用df查看设备目录使用空间大小 可以将一下不用的目录
  • 概率论的几种常考分布总结

    两点分布 0 1分布 X b 1 p 二项分布 X b n p k 0 1 2 n 指数分布 参数为 线性分布 参数为a b 泊松分布 X k 0 1 2 n
  • 程序员常犯的5个非技术性错误

    一个好的软件开发人员需要培养两种技能 技术技能和非技术技能 不幸的是一些开发者只注重技术的部分 以致养成一些陋习 下面是最常犯的5个非技术性错误 0 缺乏自律 Jim Rohn曾经说过 自律是目标和成果之间的桥梁 我一直认为 不论是成为一名
  • 半导体芯片测试介绍:CP、FT、STL

    CP测试 Chip Probing 对Wafer进行电性能测试 挑选出好的Die 可以减少封装和测试的成本 也可以透过Wafer的良率 检查fab厂制造的工艺水平 FT测试 Final Test 芯片封装完成之后 通过分选机和测试机的配合使
  • Android 兼容8.0 App全局字体调节、禁止App字体随系统字体大小而更改

    在APP中 字体的大小单位一般会用sp 然而在改变系统字体大小时 App字体就会随着系统字体大小改变而改变 这就可能造成APP布局的错位 造成这种情况的原因是 sp单位除了受屏幕密度影响外 还受到用户的字体大小影响 通常情况下 建议使用sp
  • 【周末闲谈】什么是云计算?

    个人主页 个人主页 系列专栏 周末闲谈 第一周 二进制VS三进制 第二周 文心一言 模仿还是超越 第二周 畅想AR 文章目录 前言 什么是云计算 大数据 云计算是分布式计算的一种 云计算为我们提供的三种服务 基础设置即服务 laaS 软件运
  • Unicode汉字编码表

    1 Unicode编码表 Unicode只有一个字符集 中 日 韩的三种文字占用了Unicode中0x3000到0x9FFF的部分 Unicode目前普遍采用的是UCS 2 它用两个字节来编码一个字符 比如汉字 经 的编码是0x7ECF 注
  • 几种任务调度的 Java 实现方法与比较

    I 几种任务调度的 Java 实现方法与比较 综观目前的 Web 应用 多数应用都具备任务调度的功能 本文由浅入深介绍了几种任务调度的 Java 实现方法 包括 Timer Scheduler Quartz 以及 JCron Tab 并对其
  • project facets java转成web项目

    前言 用Eclipse开发项目的时候 把一个Web项目导入到Eclipse里会变成了一个Java工程 将无法在Tomcat中进行部署运行 方法 1 找到 project文件 找到里面的
  • [GUI]stm32搭载3.5寸SPI-TFT屏移植LittleVGL

    唠几句 记录下移植笔记 新项目用到LVGL 也是首次接触GUI库 所以Emmmm 学呗 之前都是直接在LCD屏上画点 画线 画圆 画个矩形 画个多边形 显示个字符串 显示张图片而已 没有用过GUI库 在网上找了点学习资料 然后把LVGL库的
  • Springboot企业级部署解决方案

    使用springboot的童鞋们 有没曾经想把项目打包成 bin conf libs logs 等这样的结构然后直接运行的 但是找了很多办法都不够完美 因为G是个完美主义 好了直接来看解决方案 1 修改执行打包的子工程的pom xml文件
  • Emojify - v2参考答案

    Emojify Welcome to the second assignment of Week 2 You are going to use word vector representations to build an Emojifie
  • Android允许EditText获取焦点,但是不弹出系统键盘的方法

    1 以下方法可以避免弹出系统软键盘 但是scanPayDialog里面的editText也失去了焦点 scanPayDialog getWindow setSoftInputMode WindowManager LayoutParams S
  • RK3568 Debian10 固态硬盘自动挂载

    目录 需求 实现 步骤 附录 Example Field definitions 参考资料 Platform RK3568 OS Debian10 Kernel v4 19 219 Module Wdxsky SSD NVME 950 12