丽容 發表於 2025-7-2 00:00:00

ubuntu移动硬盘自动挂载报错:Error mounting: wrong fs type, bad option, bad superblock on /dev/sdb1问题的解决方法

<div id="navCategory"><h5 class="catalogue">目录</h5><ul class="first_class_ul"><li>问题描述</li><li>问题排查</li><li>处理问题</li><li>测试挂载</li><li>Ubuntu 配置固定ip的方法<ul class="second_class_ul"><li>一、图形化界面设置中配置</li></ul></li></ul></div><p>解决ubuntu移动硬盘自动挂载报错:Error mounting: wrong fs type, bad option, bad superblock on /dev/sdb1问题。</p>
<p class="maodian"></p><h2>问题描述</h2>
<p>这个移动硬盘之前插上电脑是能正常自动挂载的,突然有一天就不行了。</p>
<p class="maodian"></p><h2>问题排查</h2>
<p>查看系统日志,看有不有相关日志(可以看出我的硬盘是ntfs格式的)</p>
<div class="dxycode"><pre class="brush:bash;">sudo dmesg | tail</pre></div>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250702/2-250F2120G1455.png" /></p>
<p>关键问题:</p>
<div class="dxycode"><pre class="brush:bash;">ntfs3: sdb1: volume is dirty and "force" flag is not set!</pre></div>
<p class="maodian"></p><h2>处理问题</h2>
<p>用ntfsfix工具修复</p>
<div class="dxycode"><pre class="brush:bash;">ntfsfix --help</pre></div>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250702/2-250F2120G1D4.png" /></p>
<p>开始修复</p>
<div class="dxycode"><pre class="brush:bash;">sudo ntfsfix -d /dev/sdb1</pre></div>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250702/2-250F2120G15K.png" /></p>
<p class="maodian"></p><h2>测试挂载</h2>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250702/2-250F2120G1640.png" /></p>
<p>插入移动硬盘,点击文件管理器左侧移动硬盘,盘符右边能出现向上前头的弹出图标,说明正常自动挂载了。</p>
<p class="maodian"></p><h2>Ubuntu 配置固定ip的方法</h2>
<p>在装服务器系统的时候,DHCP自动获取ip时,路由可能会重新分配ip,为避免产生影响,可以关闭DHCP将主机设置为静态ip。</p>
<p>系统环境&ldquo;Ubuntu 22.04-Desktop</p>
<p>配置方式</p>
<p>一、如果是装的Ubuntu图形化(就是可以用鼠标操作点击应用的,一般镜像后缀为desktop),可以直接在网络设置中配置。</p>
<p>二、通过修改netplan配置文件方式进行设置。(图形化和命令行都适用)</p>
<p class="maodian"></p><h3>一、图形化界面设置中配置</h3>
<p><strong>1、打开设置找到网络,在有线连接这里点击设置齿轮图标</strong></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250702/2-250F2120G2Y3.png" /></p>
<p><strong>2、找到 IPv4 设置</strong></p>
<p>参考如下截图,取消默认DHCP,修改为手动。</p>
<p>并在下方分别配置静态 IP 地址、子网掩码、以及对应网关、DNS服务地址。</p>
<p>(分配静态IP前,请先检查有无设备占用,避免IP冲突)</p>
<p>完成后点击 &ldquo;应用&rdquo; 即可。</p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250702/2-250F2120G2340.png" /></p>
<p>二、命令行修改netplan配置文件</p>
<p>1、确定网卡和当前网关</p>
<p>查看网卡:ip a 或 ifconfig(使用ifconfig需要先安装net-tools)。</p>
<p>一般,网卡名称可能是 eno1、ens33 或其他类似的名称,按输出的名称调整即可。</p>
<p>查看网关:route -n</p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250702/2-250F2120G2450.png" /></p>
<p>2、修改配置文件</p>
<p>Netplan 是 Ubuntu 18.04 及以上版本中用于管理网络配置的工具。</p>
<p>配置文件通常位于 /etc/netplan/ 目录下,文件名通常是 01-netcfg.yaml 或类似的名称。</p>
<p>找到 /etc/netplan/ 配置文件目录,将原有配置文件备份(可选)</p>
<p>编辑配置文件:sudo nano xxxx.yaml</p>
<p>配置文件内容参考如下,替换自己主机网卡和预设ip(ip设置前先确认有无其他设备占用)</p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250702/2-250F2120G2461.png" /></p>
<p>注意配置内容间的缩进</p>
<p>参数解析:</p>
<p>dhcp4: no:禁用 DHCP,改为手动配置 IP 地址。<br />addresses:设置静态 IP 地址和子网掩码(例如 192.168.1.100/24)。<br />gateway4:设置默认网关。<br />nameservers:设置 DNS 服务器地址。</p>
<p>3、应用修改</p>
<p>配置文件编辑完之后保存,然后执行 sudo netplan apply &nbsp;应用修改内容。</p>
<p>应用修改之后,ip已经调整完毕,可以重启查看ip验证。</p>
<p>也可以尝试使用其他主机ping一下此主机的静态ip。</p>
<div class="dxycode"><pre class="brush:bash;">ping ip</pre></div>
<p>以上就是解决ubuntu移动硬盘自动挂载报错:Error mounting: wrong fs type, bad option, bad superblock on /dev/sdb1问题的详细内容,更多相关资料请阅读琼殿技术社区其它文章!</p>
頁: [1]
查看完整版本: ubuntu移动硬盘自动挂载报错:Error mounting: wrong fs type, bad option, bad superblock on /dev/sdb1问题的解决方法