xjimmyshcn

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
环境:Dell PowerEdge R905 服务器,CentOS 5.6 i386
问题:某次服务器清洗之后,文件系统出现问题,/var和/home成了只读文件系统。
[root@nsc /]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/VolGroup_ID_14746-LogVol1                     3.9G 1.3G 2.4G 35% /
/dev/mapper/VolGroup_ID_14746-LogVol2                     3.9G 139M 3.6G 4% /tmp
/dev/mapper/VolGroup_ID_14746-LogVol5                     540G 3.9G 508G 1% /usr
/dev/sda3                                                       190M 22M 159M 13% /boot    
tmpfs                                                            6.8G 0 6.8G 0% /dev/shm
/dev/mapper/VolGroup_ID_14746-LogVolBak                  807G 120G 647G 16% /bak
/dev/mapper/VolGroup_ID_14746-LogVolHome                276G 22G 241G 9% /home
/dev/mapper/VolGroup_ID_14746-LogVol4                     7.6G 3.0G 4.3G 42% /var

[root@nsc /]# rm /var/run/httpd.pid 
rm:是否删除 一般文件 “/var/run/httpd.pid”? y
rm: 无法删除 “/var/run/httpd.pid”: 只读文件系统

[root@nsc /]# mount -o remount,rw /var
mount: block device /dev/mapper/VolGroup_ID_14746-LogVol4 is write-protected, mounting read-only

同样的问题也出现在/home分区,/usr /bak正常

--------------------------------------------------------------------------------

解决:
[root@nsc /]#mkdir /usr/varbackup
[root@nsc /]#mount --move /var /usr/varbackup
[root@nsc /]#rm -rf /var 
[root@nsc /]#cd /
[root@nsc /]#mkdir -p /bak/var
[root@nsc /]#ln -s /bak/var  /var
[root@nsc /]#cp -R /usr/varbackup/* /var/

 
同样的方法处理/home
[root@nsc /]#mkdir /usr/homebackup
[root@nsc /]#mount --move /home /usr/homebackup
[root@nsc /]#rm -rf /home
[root@nsc /]#cd /
[root@nsc /]#mkdir -p /bak/home
[root@nsc /]#ln -s /bak/var /home
[root@nsc /]#cp -R /usr/homebackup/* /home

修改/etc/fstab:
[root@nsc /]# cat /etc/fstab
/dev/VolGroup_ID_14746/LogVol1 / ext3 defaults 1 1
/dev/VolGroup_ID_14746/LogVol2 /tmp ext3 defaults 1 2
/dev/VolGroup_ID_14746/LogVolBak /bak ext3 defaults 1 2
/dev/VolGroup_ID_14746/LogVol5 /usr ext3 defaults 1 2
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/VolGroup_ID_14746/LogVol0 swap swap defaults 0 0
#/dev/VolGroup_ID_14746/LogVolHome /home ext3 defaults 1 2
/dev/VolGroup_ID_14746/LogVolHome /usr/homebackup ext3 defaults 1 2
#/dev/VolGroup_ID_14746/LogVol4 /var ext3 defaults 1 2
/dev/VolGroup_ID_14746/LogVol4 /usr/varbackup ext3 defaults 1 2

上述操作完成后,reboot重启操作系统。

--------------------------------------------------------------------------------

结果:
系统正常启动

[root@nsc /]# df -h 文件系统 容量 已用 可用 已用% 挂载点 /dev/mapper/VolGroup_ID_14746-LogVol1 3.9G 1.3G 2.4G 35% / /dev/mapper/VolGroup_ID_14746-LogVol2 3.9G 139M 3.6G 4% /tmp /dev/mapper/VolGroup_ID_14746-LogVol5 540G 3.9G 508G 1% /usr /dev/sda3      190M 22M 159M 13% /boot tmpfs       6.8G 0 6.8G 0% /dev/shm /dev/mapper/VolGroup_ID_14746-LogVolBak 807G 120G 647G 16% /bak /dev/mapper/VolGroup_ID_14746-LogVolHome 276G 22G 241G 9% /usr/homebackup /dev/mapper/VolGroup_ID_14746-LogVol4 7.6G 3.0G 4.3G 42% /usr/varbackup [root@nsc /]# ll 总计 1966 drwxr-xr-x 27 root root 4096 06-10 06:36 bak drwxr-xr-x 2 root root 4096 2010-01-20 bin drwxr-xr-x 4 root root 1024 03-10 06:11 boot drwxr-xr-x 12 root root 4980 06-10 06:00 dev drwxr-xr-x 107 root root 12288 06-10 06:44 etc lrwxrwxrwx 1 root root 9 06-10 06:37 home -> /bak/home drwxr-xr-x 2 root root 4096 2006-10-10 mnt drwxr-xr-x 6 root root 4096 05-03 16:22 opt dr-xr-xr-x 336 root root 0 06-10 00:45 proc drwxr-x--- 33 root root 4096 06-10 06:01 root drwxr-xr-x 2 root root 12288 2010-01-20 sbin drwxr-xr-x 12 root root 0 06-10 00:45 sys drwxrwxrwt 15 root root 4096 06-10 06:42 tmp drwxr-xr-x 20 root root 4096 06-10 06:35 usr lrwxrwxrwx 1 root root 8 06-10 06:37 var -> /bak/var
posted on 2011-06-10 16:41  xjimmyshcn  阅读(1913)  评论(0编辑  收藏  举报