【Linux】虚拟磁盘挂载错误,不能进入系统(fsck.ext3:no such file directory)教程
错误如图中FAILED所示,这种错误一般因挂载了没有建立分区的磁盘所致,只要进入系统之后对新建的磁盘分区(见后续内容),重新加载即可,现在的问题是如何重新进入系统,对新建的磁盘建立分区。
重新进入系统的方法: 系统加载失败之后将进入维修系统,按理来说我们可以在维修系统下修改磁盘挂载配置文件/etc/fstab, 去掉加载失败磁盘对应的配置选项,但是由于系统刚启动时,以只读方式加载根文件系统,因此我们根本就无法修改配置文件/etc/fstab,当然通过命令 mount -o remount,rw / 重新以读写方式挂载根文件系统即可。
新建磁盘分区方法:
fdisk -l
得到当前系统的磁盘列表,如下图所示:
见图中提示 /dev/sdh doesn't contain a valid partition table
新建分区步骤(见黑色标注字体):
1、 fdisk /dev/sdh
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x76072764.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
The number of cylinders for this disk is set to 1305.
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)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
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 partition's 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): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305):
Using default value 1305
Command (m for help): p
Disk /dev/sdh: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x76072764
Device Boot Start End Blocks Id System
/dev/sdh1 1 1305 10482381 83 Linux
Command (m for help): w 写入分区表
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost sDK-ixp422-bqh]# mkfs.ext3 /dev/sdh1 格式化分区
mke2fs 1.40.2 (12-Jul-2007)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1310720 inodes, 2620595 blocks
131029 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 25 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.