red hat as 4 启动报错:checking filesystems fsck.ext3: bad magic number in super-block while trying to open /dev/sdc
报错原因: red hat as4中的fstab中写错导致sdc1不能mount
首先说明系统环境:
vmware worksation 6
sdc是一个8G的硬盘.使用fdisk /dev/sdc 进行了分区,操作过程如下:
[root@rhel4lvm dev]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. 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 1044.
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): n
Command action
e extended
p primary partition (1-4)
1
Invalid partition number for type `1'
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1044, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044):
Using default value 1044
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
之后建立文件系统,这个也是很标准的操作,如下:
[root@rhel4lvm dev]# mkfs.ext3 /dev/sdc1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1048576 inodes, 2096474 blocks
104823 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2147483648
64 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 (8192 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.
值得注意的是,此时还没有将此分区进行mount,所以,df -lH查询不出来,如下:
[root@rhel4lvm dev]# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/sdb2 4.9G 4.4G 224M 96% /
/dev/sdb1 99M 12M 83M 12% /boot
none 252M 0 252M 0% /dev/shm
/dev/sdb5 1012M 34M 927M 4% /tmp
执行如下命令,进行mount:
[root@rhel4lvm dev]# mount /dev/sdc1 /sourcedb
此时,再执行df命令就可以看到sdc1这个分区了,如下:
[root@rhel4lvm dev]# df -H
Filesystem Size Used Avail Use% Mounted on
/dev/sdb2 5.2G 4.7G 235M 96% /
/dev/sdb1 104M 12M 87M 12% /boot
none 264M 0 264M 0% /dev/shm
/dev/sdb5 1.1G 35M 972M 4% /tmp
/dev/sdc1 8.5G 53M 8.0G 1% /sourcedb
之后,为了能在系统启动时自动挂载分区,手工编辑/etc/fstab,恰恰这一步写错了:
[root@rhel4lvm ~]# vi /etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
LABEL=/tmp /tmp ext3 defaults 1 2
LABEL=SWAP-sdb3 swap swap defaults 0 0
/dev/sdc /sourcedb ext3 defaults 0 0
/dev/hdc /media/cdrom auto pamconsole,exec,noauto,managed 0 0
/dev/fd0 /media/floppy auto pamconsole,exec,noauto,managed 0 0
请注意,倒数第三行,应该是 dev/sdc1,当时是没有问题,重新启动red hat 时,有报错:
checking filesystems fsck.ext3: bad magic number in super-block while trying to open /dev/sdc [FAILED]
*** An error occured during the file system check.
*** Dropping you to a shell;the system will reboot
*** when you leave the shell.
Give root password for maintenance
(or type Control-D to continue):
折腾了好半天才发现是/etc/fstab写错了.哎..不熟+粗心害死人啊!!!!!!!!!!!!!!!!!