博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux格式化分区报错Could not start /dev/sda No such file or directory 解决办法
阅读量:4519 次
发布时间:2019-06-08

本文共 3811 字,大约阅读时间需要 12 分钟。

Linux查看已经分好的区

[root@linuxidc ~]# 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?

[root@linuxidc ~]# 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重新读取分区表。 
因此,使用该命令就可以创建分区并且在不重新启动机器的情况下系统能够识别这些分区。
 
查看是否安装过该命令:
[root@linuxidc~]# rpm -q parted 
packageparted is not installed

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

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

 Loadedplugins: fastestmirror

1234567 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

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!

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

[root@linuxidc~]# rpm -q parted 
parted-2.1-25.el6.i686

执行一下该命令:

[root@linuxidc~]# 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了,如果还提示出错,重启之后再执行格式化就可以了。

[root@linuxidc~]# 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.

转载于:https://www.cnblogs.com/yfz0/p/5765879.html

你可能感兴趣的文章
HDU1548--A strange lift
查看>>
动态规划位置hdu 4540 威威猫系列故事——打地鼠(动态规划)
查看>>
阿里巴巴卖空阿里巴巴入股新浪微博抑制投资者卖空行为
查看>>
分析打开hdu 3335 (最小路径覆盖)
查看>>
添加源ubuntu_x64 安装 Adobe Reader
查看>>
NFS-heartbeat-drbd模拟NFS高可用
查看>>
SQL Server性能调优:资源管理之内存管理篇(上)
查看>>
javaScript 基础知识
查看>>
接近开关,光耦
查看>>
基于visual Studio2013解决C语言竞赛题之1033数字交换
查看>>
给datalist加自动编号(解决博客的第XX楼)
查看>>
BZOJ3282: Tree (LCT模板)
查看>>
ES6中变量的解构赋值
查看>>
编译器C-Free V352注册算法分析
查看>>
数据绑定控件Reperter
查看>>
【codeforces】【比赛题解】#937 CF Round #467 (Div. 2)
查看>>
剑指Offer学习笔记(3)——解决面试题的思路
查看>>
.NET Framework基础知识(二)(转载)
查看>>
Yii DataProvider
查看>>
BestCoder Round #14 B 称号 Harry And Dig Machine 【TSP】
查看>>