修复错误配置fstab导致系统无法正常启动.doc_第1页
修复错误配置fstab导致系统无法正常启动.doc_第2页
修复错误配置fstab导致系统无法正常启动.doc_第3页
修复错误配置fstab导致系统无法正常启动.doc_第4页
修复错误配置fstab导致系统无法正常启动.doc_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

修复错误配置fstab文件导致系统无法正常启动1. 问题再现1.1. 操作环境说明 操作系统:CentOS5.2 硬盘分区情况: rootlocalhost # fdisk /dev/sdaThe 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)Command (m for help): pDisk /dev/sda: 10.7 GB, 10737418240 bytes255 heads, 63 sectors/track, 1305 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks IdSystem/dev/sda1 * 1 522 4192933+83Linux/dev/sda2 523 783 2096482+83Linux/dev/sda3 784 914 1052257+82Linux swap / SolarisCommand (m for help): v6288172 unallocated sectors fstab文件:rootlocalhost # more /etc/fstab LABEL=/ / ext3 defaults 1 1LABEL=/tmp /tmp ext3 defaults 1 2tmpfs /dev/shm tmpfs defaults 0 0devpts /dev/pts devptsgid=5,mode=6200 0sysfs /sys sysfs defaults 0 0proc /proc proc defaults 0 0LABEL=SWAP-sda3 swap swap defaults 0 0 1.2. 创建新的分区,并配置fstab文件1.2.1. 创建分区 在/dev/sda上创建新的主分区sda4rootlocalhost # fdisk /dev/sdaThe 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)Command (m for help): pDisk /dev/sda: 10.7 GB, 10737418240 bytes255 heads, 63 sectors/track, 1305 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks IdSystem/dev/sda1 * 1 522 4192933+83Linux/dev/sda2 523 783 2096482+83Linux/dev/sda3 784 914 1052257+82Linux swap / SolarisCommand (m for help): nCommand action e extended p primary partition (1-4)pSelected partition 4First cylinder (915-1305, default 915): Using default value 915Last cylinder or +size or +sizeM or +sizeK (915-1305, default 1305): Using default value 1305Command (m for help): pDisk /dev/sda: 10.7 GB, 10737418240 bytes255 heads, 63 sectors/track, 1305 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks IdSystem/dev/sda1 * 1 522 4192933+83Linux/dev/sda2 523 783 2096482+83Linux/dev/sda3 784 914 1052257+82Linux swap / Solaris/dev/sda4 915 1305 3140707+83LinuxCommand (m for help): wThe 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. 创建文件系统,将Label设置为otherrootlocalhost # mke2fs -j -L other /dev/sda4mke2fs 1.39 (29-May-2006)Filesystem label=otherOS type: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)393216 inodes, 785176 blocks39258 blocks (5.00%) reserved for the super userFirst data block=0Maximum filesystem blocks=80530636824 block groups32768 blocks per group, 32768 fragments per group16384 inodes per groupSuperblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912Writing inode tables: done Creating journal (16384 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 20 mounts or180 days, whichever comes first.Use tune2fs -c or -i to override.rootlocalhost # e2label /dev/sda4other Mount /dev/sda4到 /othersrootlocalhost /# mkdir /othersrootlocalhost /# mount /dev/sda4 /othersrootlocalhost /# mount/dev/sda1 on / type ext3 (rw)proc on /proc type proc (rw)sysfs on /sys type sysfs (rw)devpts on /dev/pts type devpts (rw,gid=5,mode=620)/dev/sda2 on /tmp type ext3 (rw)tmpfs on /dev/shm type tmpfs (rw)none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)/dev/sda4 on /others type ext3 (rw)rootlocalhost /# cd /othersrootlocalhost others# ls -ltotal 16drwx- 2 root root 16384 Nov 21 19:35 lost+foundrootlocalhost others# 修改fstab文件rootlocalhost /# vi /etc/fstab LABEL=/ / ext3 defaults 1 1LABEL=/tmp /tmp ext3 defaults 1 2tmpfs /dev/shm tmpfs defaults 0 0devpts /dev/pts devptsgid=5,mode=6200 0sysfs /sys sysfs defaults 0 0proc /proc proc defaults 0 0LABEL=SWAP-sda3 swap swap defaults 0 0LABEL=/other /others ext3 defaults 1 2 请注意:这里用到是LABEL而不是设备名(/dev/sda4),但是这里把卷标写错,应该是other,前面没有 /。 并且没有运行mount -a命令来验证配置是否正确。 接着就直接重启系统了(init 6)。rootlocalhost /# init 6 1.3. 问题的出现1.3.1. 在重启时遇到问题图1.1 系统发现fstab中的LABEL=/other卷标不存在。2. 故障的解决过程2.1. 进入运行级别1 输入root用户密码,进入运行级别1 图2.1 此时试图修改/etc/fstab文件图2.2 此时发现文件系统是只读的 重新mount /图2.3 再次修改fstab文件 图2.4 修改完成,重启系统(init 6)。 系统可以正常启动,问题解决了。图2.53. 问题总结 以上问题的出现是由于错误配置了/e

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论