PHP程序员让我删除一个缓存目录我怎么也删除不了 rm -rf mv cp 都显示只读文件系统,因为是内网服务器我就想重启下试下吧。结果...启动不起来了。(内网服务器是调试的程序都在这上面弄不好就完了)
我就接上显示器一看 报的错误:
your system apperars to have shutdown uncleanly
Press Y within 1 seconds to force filesystem integrity check....
checking root filesystem
我就进入单用户模式: e e = 1 回车 b
单用户模式他会自己检测 文件系统 ,然后检测失败,输入密码自己手动修复。。。。
*** AN error occurred during the file system check
*** Dropping you to a shell; the systm will reboot
*** when you leave the shell
Give root password for maintenance
(or type Control-D to continue):
Login incorrect.
(Repair filesystem) 1 #
(Repair filesystem) 2 #fsck -A -y
#上次非正常关机引起的,用fsck /dev/hdaX后reboot进入,或只用fsck来修复,只管y回车
(Repair filesystem) 3 #init 6
结果好了。。。
fsck
|
|
fsck(file system check)
第二种情况:由于/etc/fstab文件编辑错误而引起的不能正常进入系统 解决方法就是修改/etc/fstab文件成原来正常格式删除错误的或者是不存在的挂载目录 操作:根据提示进入修复模式 Login incorrect. (Repair filesystem) 1 # mount -o remount,rw / (Repair filesystem) 1 #reboot |
第三种情况:我第一次做缩小LVM 分区的实验失败了,现在想起来就写这了。
进入修复模式 重新加载 /分区 mount -o remount,rw /
vi /etc/fstab 把 1 2 改成 0 0 开机不检测这个分区 进去重新修复或者直接在修复模式修复。
LVM 缩小必须先缩小文件系统在缩小分区的大小不然就会导致文件系统比分区大而启动错误。
下面看下我LVM 的成功案例:
在线将home分区扩展到750M,然后缩小到600M左右 并且可以正常使用
实验步骤:
1[root@localhost ~]# fdisk /dev/sda
2.n 添加 ,回车自动分配磁面 ,+300M 指定大小 ,p查看下最好,t改类型 8 改成8e ,w 保存。
3.[root@localhost ~]# partprobe 重新加载分区
4.[root@localhost ~]# pvcreate /dev/sda8 创建PV
5.[root@localhost ~]# vgextend vg01 /dev/sda8 扩展VG
6.[root@localhost ~]# lvextend -L 750M /dev/vg01/lvhome 扩展LV
7.[root@localhost ~]# resize2fs /dev/vg01/lvhome 扩展文件
8.[root@localhost ~]# tune2fs -l /dev/vg01/lvhome | grep Block 查看
Block count: 770048
Block size: 1024
Blocks per group: 8192
扩充完毕!
缩小必须离线缩小 先缩小文件在缩小LV
1.[root@localhost ~]# e2fsck -f /dev/vg01/lvhome 必须先检测
2.[root@localhost ~]# resize2fs /dev/vg01/lvhome 600M
3.[root@localhost ~]# tune2fs -l /dev/vg01/lvhome |grep Block 查看
Block count: 614400
Block size: 1024
Blocks per group: 8192
4.[root@localhost ~]# lvreduce -L 600M /dev/vg01/lvhome
5.Yes
6.重启测试:启动成功则成功。
7.[root@localhost ~]# df -h