Linux格式化分区报错Could not start /dev/sda No such file or directory 解决办法

简介:

查看已经分好的区

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@yong ~] # fdisk -l /dev/sda
  
Disk  /dev/sda : 21.5 GB, 21474836480 bytes
255 heads, 63 sectors /track , 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280bytes
Sector size (logical /physical ): 512 bytes  /512  bytes
I /O  size (minimum /optimal ): 512 bytes / 512bytes
Disk identifier: 0x7d57cb1f
  
   Device Boot      Start         End      Blocks  Id  System
/dev/sda1                1        2610   20964793+   5  Extended
/dev/sda5                1         128    1028097   83  Linux
/dev/sda6              129         256    1028128+  83  Linux
/dev/sda7              257         384    1028128+  83  Linux

格式化新分区的时候,报错,提示下面的错误,没有这个文件或目录。

Could not stat /dev/sda7 --- No such fileor directory

The device apparently does not exist; didyou specify it correctly?


1
2
3
4
5
[root@yong ~] # mke2fs -t ext4 /dev/sda7
mke2fs 1.41.12 (17-May-2010)
Could not stat  /dev/sda7  --- No such fileor directory
  
The device apparently does not exist; didyou specify it correctly?

 

解决方法:执行partprobe 命令

partprobe包含在parted的rpm软件包中。

partprobe可以修改kernel中分区表,使kernel重新读取分区表。 

因此,使用该命令就可以创建分区并且在不重新启动机器的情况下系统能够识别这些分区。

 

查看是否安装过该命令:

1
2
[root@yong~] # rpm -q parted
packageparted is not installed


提示没有安装过,则需要安装parted

安装命令:#yum install parted #前提是保证你的虚拟机可以上网,要从网络下载安装包

1
[root@yong~] # yum install parted

 Loadedplugins: fastestmirror

1
2
3
4
5
6
7
Loadingmirror speeds from cached hostfile
  * base: mirrors.skyshe.cn
  * extras: mirrors.skyshe.cn
  * updates: mirrors.skyshe.cn
base                                                 | 3.7 kB     00:00     
extras                                                |3.3 kB     00:00     
updates                                              | 3.4 kB     00:00
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Settingup Install Process
ResolvingDependencies
-->Running transaction check
--->Package parted.i686 0:2.1-25.el6 will be installed
-->Finished Dependency Resolution
  
DependenciesResolved
  
=============================================================================
  Package          Arch           Version                Repository      Size
=============================================================================
Installing:
  parted           i686           2.1-25.el6             base           595 k
  
TransactionSummary
=============================================================================
Install       1 Package(s)
  
Totaldownload size: 595 k
Installedsize: 2.1 M
Isthis ok [y /N ]: y
DownloadingPackages:
parted-2.1-25.el6.i686.rpm                            | 595 kB    00:16     
Runningrpm_check_debug
RunningTransaction Test
TransactionTest Succeeded
RunningTransaction
   Installing : parted-2.1-25.el6.i686                                    1 /1 
   Verifying : parted-2.1-25.el6.i686                                   1 /1 
  
Installed:
   parted.i686 0:2.1-25.el6                                                  
  
Complete!


安装完成后,再进行查询一次,已经安装成功。

1
2
[root@yong~] # rpm -q parted
parted-2.1-25.el6.i686


 

执行一下该命令:

1
2
3
4
5
6
[root@yong~] # partprobe
Warning:WARNING: the kernel failed to re- read  the partition table on  /dev/sda  (Deviceor resource busy).  As a result, it maynot reflect all of your changes  until  after reboot.
Warning:WARNING: the kernel failed to re- read  the partition table on  /dev/sdb  (Deviceor resource busy).  As a result, it maynot reflect all of your changes  until  after reboot.
Warning:Unable to  open  /dev/sr0  read -write (Read-only  file  system).   /dev/sr0  has been opened  read -only.
Warning:Unable to  open  /dev/sr0  read -write (Read-only  file  system).   /dev/sr0  has been opened  read -only.
Error:Invalid partition table - recursive partition on  /dev/sr0 .

 

然后执行格式化,就OK了,如果还提示出错,重启之后再执行格式化就可以了。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[root@yong~] # mkfs -t ext4 /dev/sda7
mke2fs1.41.12 (17-May-2010)
Filesystemlabel=
OStype: Linux
Blocksize=4096 (log=2)
Fragmentsize=4096 (log=2)
Stride=0blocks, Stripe width=0 blocks
64384inodes, 257032 blocks
12851blocks (5.00%) reserved  for  the super user
Firstdata block=0
Maximumfilesystem blocks=264241152
8block  groups
32768blocks per group, 32768 fragments per group
8048inodes per group
Superblockbackups stored on blocks: 
     32768, 98304, 163840, 229376
  
Writinginode tables:  done                           
Creatingjournal (4096 blocks):  done
Writingsuperblocks and filesystem accounting information:  done
  
Thisfilesystem will be automatically checked every 35 mounts or
180days, whichever comes first.  Use tune2fs-c or -i to override.






本文转自 模范生 51CTO博客,原文链接:http://blog.51cto.com/mofansheng/1585612,如需转载请自行联系原作者

目录
相关文章
|
Linux 数据库
Linux中第一次使用locate命令报错?????
在Linux CentOS7系统中,使用`locate`命令时出现“command not found”错误,原因是缺少`mlocate`包。解决方法是通过`yum install mlocate -y`或`apt-get install mlocate`安装该包,并执行`updatedb`更新数据库以解决后续的“can not stat”错误。
480 9
|
Ubuntu Linux Windows
linux 挂载硬盘报错 "mount: unknown filesystem type 'ntfs'"
【10月更文挑战第7天】在Linux系统中挂载硬盘时遇到“mount: unknown filesystem type 'ntfs'”错误,是因为Linux默认可能不支持NTFS文件系统。本文提供了解决方案:安装NTFS-3G软件包以支持NTFS,并检查内核是否已加载NTFS模块。对于Ubuntu/Debian系统,可使用`sudo apt-get install ntfs-3g`命令;对于CentOS/RHEL系统,则需先安装EPEL仓库再安装NTFS-3G。此外,还需确认硬盘设备名正确无误,并创建合适的挂载点目录。
4376 2
|
10月前
|
Linux 应用服务中间件 Shell
二、Linux文本处理与文件操作核心命令
熟悉了Linux的基本“行走”后,就该拿起真正的“工具”干活了。用grep这个“放大镜”在文件里搜索内容,用find这个“探测器”在系统中寻找文件,再用tar把东西打包带走。最关键的是要学会使用管道符|,它像一条流水线,能把这些命令串联起来,让简单工具组合出强大的功能,比如 ps -ef | grep 'nginx' 就能快速找出nginx进程。
1024 1
二、Linux文本处理与文件操作核心命令
|
10月前
|
Linux
linux命令—stat
`stat` 是 Linux 系统中用于查看文件或文件系统详细状态信息的命令。相比 `ls -l`,它提供更全面的信息,包括文件大小、权限、所有者、时间戳(最后访问、修改、状态变更时间)、inode 号、设备信息等。其常用选项包括 `-f` 查看文件系统状态、`-t` 以简洁格式输出、`-L` 跟踪符号链接,以及 `-c` 或 `--format` 自定义输出格式。通过这些选项,用户可以灵活获取所需信息,适用于系统调试、权限检查、磁盘管理等场景。
659 137
|
10月前
|
安全 Ubuntu Unix
一、初识 Linux 与基本命令
玩转Linux命令行,就像探索一座新城市。首先要熟悉它的“地图”,也就是/根目录下/etc(放配置)、/home(住家)这些核心区域。然后掌握几个“生存口令”:用ls看周围,cd去别处,mkdir建新房,cp/mv搬东西,再用cat或tail看文件内容。最后,别忘了随时按Tab键,它能帮你自动补全命令和路径,是提高效率的第一神器。
1613 58
|
JSON 自然语言处理 Linux
linux命令—tree
tree是一款强大的Linux命令行工具,用于以树状结构递归展示目录和文件,直观呈现层级关系。支持多种功能,如过滤、排序、权限显示及格式化输出等。安装方法因系统而异常用场景包括:基础用法(显示当前或指定目录结构)、核心参数应用(如层级控制-L、隐藏文件显示-a、完整路径输出-f)以及进阶操作(如磁盘空间分析--du、结合grep过滤内容、生成JSON格式列表-J等)。此外,还可生成网站目录结构图并导出为HTML文件。注意事项:使用Tab键补全路径避免错误;超大目录建议限制遍历层数;脚本中推荐禁用统计信息以优化性能。更多详情可查阅手册mantree。
1160 143
linux命令—tree
|
9月前
|
存储 安全 Linux
Linux卡在emergency mode怎么办?xfs_repair 命令轻松解决
Linux虚拟机遇紧急模式?别慌!多因磁盘挂载失败。本文教你通过日志定位问题,用`xfs_repair`等工具修复文件系统,三步快速恢复。掌握查日志、修磁盘、验重启,轻松应对紧急模式,保障系统稳定运行。
1497 2
|
10月前
|
Unix Linux 程序员
Linux文本搜索工具grep命令使用指南
以上就是对Linux环境下强大工具 `grep` 的基础到进阶功能介绍。它不仅能够执行简单文字查询任务还能够处理复杂文字处理任务,并且支持强大而灵活地正则表达规范来增加查询精度与效率。无论您是程序员、数据分析师还是系统管理员,在日常工作中熟练运用该命令都将极大提升您处理和分析数据效率。
809 16