Linux修复磁盘坏道,重新挂载硬盘

修复磁盘

挂载报错:

[root@localhost ~]$ mount /dev/sdb /mnt/mydev
mount: /dev/sdb is write-protected, mounting read-only
mount: wrong fs type, bad option, bad superblock on /dev/sdb,missing codepage or helper program, or other errorIn some cases useful info is found in syslog - trydmesg | tail or so.

检查文件系统也报错:

[root@localhost ~]$ fsck -f /dev/sdb
e2fsck 1.42.9 (28-Dec-2013)
ext2fs_open2: Bad magic number in super-block
fsck.ext2: Superblock invalid, trying backup blocks...
fsck.ext2: Bad magic number in super-block while trying to open /dev/sdbThe superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:e2fsck -b 8193 <device>

使用提示命令修复失败:

[root@localhost ~]$ e2fsck -b 8193 /dev/sdb
e2fsck 1.42.9 (28-Dec-2013)
e2fsck: Bad magic number in super-block while trying to open /dev/sdbThe superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:e2fsck -b 8193 <device>

磁盘坏道
重新格式化:

[root@localhost ~]$ mkfs -t ext4 /dev/sdb
mke2fs 1.42.9 (28-Dec-2013)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
244056064 inodes, 976224256 blocks
48811212 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=3124756480
29792 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000, 214990848, 512000000, 550731776, 644972544Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

再次检查状态,已经正常:

[root@localhost ~]$ fsck -f /dev/sdb
fsck from util-linux 2.23.2
e2fsck 1.42.9 (28-Dec-2013)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb: 11/244056064 files (0.0% non-contiguous), 15378664/976224256 blocks

挂载磁盘

列出系统中当前连接的硬盘:

[root@localhost ~]$ fdisk -l
Disk /dev/sda: 292.3 GB, 292326211584 bytes, 570949632 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
Disk label type: dos
Disk identifier: 0x00024085Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   570949631   284425216   8e  Linux LVMDisk /dev/sdb: 3998.6 GB, 3998614552576 bytes, 7809794048 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

/dev/sdb是新的物理盘,没有逻辑分区,需要先分区:

[root@localhost ~]$ fdisk /dev/sdb
Command (m for help): n
Partition type:p   primary (0 primary, 0 extended, 4 free)e   extended
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-4294967295, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-4294967294, default 4294967294): 
Using default value 4294967294
Partition 1 of type Linux and of size 2 TiB is set

查看刚刚创建的新分区:

Command (m for help): pDisk /dev/sdb: 3998.6 GB, 3998614552576 bytes, 7809794048 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
Disk label type: dos
Disk identifier: 0xe0692258Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048  4294967294  2147482623+  83  Linux

确认并保存修改:

Command (m for help): w
The partition table has been altered!Calling ioctl() to re-read partition table.
Syncing disks.

格式化新分区

[root@localhost ~]$ mkfs.ext4 /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
134217728 inodes, 536870655 blocks
26843532 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
16384 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000, 214990848, 512000000Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done 

挂载:

[root@localhost ~]$ mount /dev/sdb1 /mnt/mydev/

查看:

[root@localhost ~]$ df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   50G  9.3G   41G  19% /
devtmpfs                  48G     0   48G   0% /dev
tmpfs                     48G     0   48G   0% /dev/shm
tmpfs                     48G   34M   48G   1% /run
tmpfs                     48G     0   48G   0% /sys/fs/cgroup
/dev/sda1               1014M  180M  835M  18% /boot
/dev/mapper/centos-home  218G   57M  218G   1% /home
tmpfs                    9.5G   52K  9.5G   1% /run/user/1000
/dev/sdc4                 29G  4.3G   25G  15% /run/media/uxdb/CentOS 7 x8
/dev/sdb1                2.0T   81M  1.9T   1% /mnt/mydev

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/213893.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

15、lambda表达式、右值引用、移动语义

前言 返回值后置 auto 函数名 (形参表) ->decltype(表达式) lambda表达式 lambda表达式的名称是一个表达式 (外观类似函数)&#xff0c;但本质绝非如此 语法规则 [捕获表] (参数表) 选项 -> 返回类型 { 函数体; }lambda表达式的本质 lambda表达式本质其实是一个类…

textarea文本框回车enter的时候自动提交表单,根据内容自动高度

切图网近期一个bootstrap5仿chatgpt页面的项目遇到的&#xff0c;textarea文本框回车enter的时候自动提交表单&#xff0c;根据内容自动高度&#xff0c;代码如下&#xff0c;亲测可用。 <textarea placeholder"Message ChatGPT…" name"" rows"&q…

TypeScript 第五节:条件语句

一、TypeScript 中常用的条件语句 TypeScript 的条件语句与 JavaScript 的条件语句类似&#xff0c;包括 if 语句、if...else 语句、switch 语句等。 1、if 语句 if 语句用于判断指定条件是否为 true&#xff0c;如果是 true&#xff0c;则执行一段代码块。 示例&#xff1a;…

命名空间this_thread

命名空间 - this_thread 在C11中不仅添加了线程类&#xff0c;还添加了一个关于线程的命名空间std::this_thread&#xff0c;在这个命名空间中提供了四个公共的成员函数&#xff0c;通过这些成员函数就可以对当前线程进行相关的操作了。 1.get_id() 调用命名空间std::this_t…

java脚本引擎Groovy动态执行

1.java脚本引擎Groovy实战_groovy脚本-CSDN博客 2.java可用的动态脚本引擎和动态代码执行_java动态执行代码片段-CSDN博客 3.Groovy动态加载Java代码的使用方法和工具类_groovy调用java类方法-CSDN博客 4.springboot应用动态运行groovy脚本-附源码 - 简书 (jianshu.com) 5.…

是不是学了低代码就自动放弃了高薪?内部资深解答来了!

目录 前言低代码开发&#xff1a;点餐还是自助烹饪&#xff1f;低代码的“菜单”低代码的局限性 市场影响的分析&#xff1a;一场关于低代码的对话低代码开发与程序员职业&#xff1a;名人视角解析总结 前言 近年来&#xff0c;低代码开发因其低门槛、高效率和易集成的特点受到…

conda 计算当前包的个数

Conda是一个强大的包管理器和环境管理器&#xff0c;它用于安装和管理来自不同源的软件包。若要计算当前conda环境中安装的包的数量&#xff0c;你可以使用以下命令&#xff1a; 首先&#xff0c;激活你想要检查的conda环境&#xff08;如果不是默认的base环境&#xff09;&am…

虹科新闻丨广州市“强企增效”项目助力虹科高质量发展!

来源&#xff1a;虹科电子科技有限公司 虹科新闻丨广州市“强企增效”项目助力虹科高质量发展&#xff01; 原文链接&#xff1a;https://mp.weixin.qq.com/s/9pUXx5ZZpIi5S4s4o90GJA 欢迎关注虹科&#xff0c;为您提供最新资讯&#xff01; 2023年12月6日至7日&#xff0c;工…

hive/spark用法记录

1. cast()更改数据类型 cast(column_name as type) 2. get_dt_date()自定义日期操作函数&#xff08;返回不带横线的日期&#xff09; select get_dt_date();–获取当前日期&#xff0c;返回 20170209 select get_dt_date(get_date(-2));–获取当前日期偏移&#xff0c;转为…

如果将视频转化为gif格式图

1.选择视频转换GIF&#xff1a; 2.添加视频文件&#xff1a; 3.点击“开始”&#xff1a; 4.选择设置&#xff0c;将格式选择为1080P更加清晰&#xff1a; 5.输出后的效果图&#xff1a;

postgresql设置免密登录

您提供的步骤描述了在 PostgreSQL 数据库环境中配置服务器间的 SSH 无密码登录和数据库用户认证的过程。这些步骤主要用于设置一个高可用性、负载平衡的数据库集群环境。让我们逐一解释这些步骤的目的和应用场景&#xff1a; 1. 启动 PostgreSQL 服务 systemctl start postgr…

ReetrantReadWriteLock底层原理

文章目录 一、读写锁介绍二、ReentrantReadWriteLock底层原理1. 读写锁的设计 一、读写锁介绍 现实中有这样一种场景:对共享资源有读和写的操作&#xff0c;且写操作没有读操作那么频繁(读多写少)。在没有写操作的时候&#xff0c;多个线程同时读一个资源没有任何问题&#xf…

jQuery-操作DOM

使用jQuery操作DOM dom : 文档对象模型 就是HTML元素 $() 函数的2个用法: 用法1:放入一个字符串(选择器)表示获取元素 例如 $("p") $("#abc") $(".del") 用法2:放入一个函数&#xff0c;表示文档就绪函数 例如 $(function(){代…

TikTok挑战榜单:全球用户如何共襄盛举

TikTok作为全球最受欢迎的短视频应用之一&#xff0c;在这个平台上&#xff0c;用户们通过参与各种挑战&#xff0c;创造了无数令人惊叹的短视频。 本文将深入探讨TikTok挑战榜单的现象&#xff0c;探究全球用户如何共襄盛举&#xff0c;以及这种创意激发和社交互动如何成为Ti…

go-zero开发入门-API网关鉴权开发示例

本文是go-zero开发入门-API网关开发示例一文的延伸&#xff0c;继续之前请先阅读此文。 在项目根目录下创建子目录 middleware&#xff0c;在此目录下创建文件 auth.go&#xff0c;内容如下&#xff1a; // 鉴权中间件 package middlewareimport ("context""e…

前端开发常用的Vscode插件整理(持续更新)

本文记录用vscode进行前端开发时&#xff0c;常用到的有用的vscode插件&#xff0c;将不定时更新&#xff5e; 1、Chinese (Simplified) 将编辑器变成简体中文 2、vscode-icon 让 vscode 资源树目录加上图标&#xff0c;官方出品的图标库 3、Import Cost 引入包大小计算,对于…

Springboot Redis Lua 分布式限流器

pom文件中添加如下依赖包&#xff0c;比较关键的就是 spring-boot-starter-data-redis 和 spring-boot-starter-aop。 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></d…

基于ssm实验室开放管理系统论文

摘 要 现代经济快节奏发展以及不断完善升级的信息化技术&#xff0c;让传统数据信息的管理升级为软件存储&#xff0c;归纳&#xff0c;集中处理数据信息的管理方式。本实验室开放管理系统就是在这样的大环境下诞生&#xff0c;其可以帮助管理者在短时间内处理完毕庞大的数据信…

高效纯化树脂A-2313 CPR

在化工、制药等行业中&#xff0c;对colorful chemicals的纯化一直是挑战。本文将为您介绍一款具有卓越性能的强碱性阴离子交换树脂——Tulsion A-2313 CPR。通过分析其特性和应用&#xff0c;展示其在colorful chemicals纯化领域的优势。 一、Tulsion A-2313 CPR离子交换树脂的…

代码随想录二刷 |二叉树 |94.二叉树的中序遍历

代码随想录二刷 &#xff5c;二叉树 &#xff5c;二叉树的中序遍历 题目描述解题思路代码实现迭代法递归法 题目描述 94.二叉树的中序遍历 给定一个二叉树的根节点 root &#xff0c;返回 它的 中序 遍历 。 示例 1&#xff1a; 输入&#xff1a;root [1,null,2,3] 输出&a…