zl程序教程

您现在的位置是:首页 >  系统

当前栏目

Linux 格式化分区 报错Could not stat /dev/sda3 --- No such file or directory

Linux 报错 not --- File No or 分区
2023-09-14 08:59:37 时间
[root@jyrac2 ~]# fdisk /dev/sda

The number of cylinders for this disk is set to 3002.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sda: 24.6 GB, 24696061952 bytes
255 heads, 63 sectors/track, 3002 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2355 18916506 83 Linux
/dev/sda2 2356 2610 2048287+ 82 Linux swap / Solaris

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partitions system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): u
Changing display/entry units to sectors

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First sector (41929650-48234495, default 41929650):
Using default value 41929650
Last sector or +size or +sizeM or +sizeK (41929650-48234495, default 48234495):
Using default value 48234495

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
You have new mail in /var/spool/mail/root

[root@jyrac2 ~]# fdisk -l

Disk /dev/sda: 24.6 GB, 24696061952 bytes
255 heads, 63 sectors/track, 3002 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2355 18916506 83 Linux
/dev/sda2 2356 2610 2048287+ 82 Linux swap / Solaris
/dev/sda3 2611 3003 3152423 83 Linux
新的分区为/dev/sda3

对分区进行格式化:
[root@jyrac2 /]# mkfs.ext3 /dev/sda3
mke2fs 1.39 (29-May-2006)
Could not stat /dev/sda3 --- No such file or directory

The device apparently does not exist; did you specify it correctly?

解决这个问题可以使用partprobe 命令,partprobe包含在parted的rpm软件包中。partprobe可以修改kernel中分区表,使kernel重新读取分区表。 因此,使用该命令就可以创建分区并且在不重新启动机器的情况下系统能够识别这些分区。
检查是否安装了partprobe软件包
[root@jyrac2 /]# rpm -q parted
parted-1.8.1-23.el5

[root@jyrac2 /]# partprobe
[root@jyrac2 /]# mkfs -t ext3 /dev/sda3
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
394400 inodes, 788105 blocks
39405 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=809500672
25 block groups
32768 blocks per group, 32768 fragments per group
15776 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912

Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
You have new mail in /var/spool/mail/root
格式化分区成功
[root@jyrac2 /]# mkdir /u02
[root@jyrac2 /]# mount /dev/sda3 /u02
[root@jyrac2 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 18G 16G 1.5G 92% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
/dev/sda3 4.0G 237M 3.6G 7% /u02


10.18 Linux mke2fs命令格式化硬盘(给硬盘写入文件系统) 前面讲到,mkfs 命令为硬盘分区写入文件系统时,无法手动调整分区的默认参数(比如块大小是 4096 Bytes),如果想要调整,就需要使用本节介绍的 mke2fs 命令。
Linux硬盘分区,卸载,挂载,格式化,加到开机启动项 0、创建挂载目录 mkdir -p /www 1、确认是否有没有分区的磁盘,如下图,没有分区的磁盘是 /dev/xvdb ,在您的服务器中可能是 /dev/vdb 请注意按实际名称修改 fdisk -l 2、为磁盘分区,若已分区的,请跳过! fdisk /dev/xvdb 3、输入n开始创建分.
一、问题背景 在使用mkfs格式化1TB左右容量的硬盘时发现所耗费的时间很长,简直是一种折磨。
eric0435 系统架构师(高级工程师),ACOUG amp;CSOUG核心成员,Oracle Young Expert 。政府信息化技术顾问。湖南省政府采购评审专家,从2007年开始从事社会保险系统开发,应用架构设计,数据库管理工作。擅长Oracle数据库故障诊断,性能调优。