Archive for the 'Linux' Category



Either the superblock or the partition table is likely to be corrupted的解决

昨天在debian搞软raid1遇见的问题,在把制作好md0后,在fstab文件加上对应的mount位置,在重启后检查磁盘出错!

在执行fsck /dev/md0就出现,Either the superblock or the partition table is likely to be corrupted 问题,对应的还有一句话,没有抄下来,在google大人的引领下,找到解决方法,网址如下:

http://www.linuxquestions.org/questions/linux-hardware-18/size-in-superblock-is-different-from-the-physical-size-of-the-partition-298175/

也是类似出现
The filesystem size (according to the superblock) is 10485760 blocks
The physical size of the device is 10477568 blocks
Either the superblock or the partition table is likely to be corrupt!

我的不是10485760这个数值,我按照:
resize2fs -f /dev/md0 10477568
这个格式命令,输入我的那个数值,结果一切问题解决。

fsck /dev/md0通过检查,没问题!

其实我的问题,我猜想可能是两个不同型号的西数1T绿盘组成软raid1造成的!

WDC WD10EARS 和 WDC WD10EADX 这两个绿盘
WDC WD10EARS是我在之前买的,已经有很多数据,WDC WD10EADX 是前两天买的。

数据大概如下吧:sda是WDC WD10EARS,sdb是WDC WD10EADX
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
256 heads, 63 sectors/track, 121126 cylinders
Units = cylinders of 16128 * 512 = 8257536 bytes
Disk identifier: 0×00000000

Device Boot Start End Blocks Id System
/dev/sda1 1 121127 976762552 fd Linux raid autodetect

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x2b0f9d40

Device Boot Start End Blocks Id System
/dev/sdb1 1 121601 976760001 fd Linux raid autodetect

现在问题解决了,一切正常了,我的家用文件服务器终于进入raid时代了,虽然是软raid .

Tag:

哎,还是放弃FreeNas了!

FreeNas这玩意儿太不稳定了,太容易崩溃了,而且容易死机,挑硬件挑得很厉害,也可能是我的硬件配置太过年代久远了,piii667,815E主板,单条128m两条,一张西霸的sli3134的pci转sata, 2个1T WD蓝盘做raid 1,1个N久前的ST盘,只有1.3G的,不过这硬盘很吵啊.

今天转换成用debian, 最小安装, mdadm 的软raid控制,自装samba,貌似很稳定,不过无web界面管理,自己手工配置,虽然麻烦点,但胜在配置清晰名了,安装了webmin管理的系统,不过我还是喜欢ssh命令操作.

今天用了一整天在学习linux的软raid操作,现在看起来都比较容易操控。

现在系统能全速复制文件,用FreeNas时,复制文件时速率超级不稳定,维持在60%左近的跳动,很不好.

还是linux系统作NAS好,而且Linux对这些老硬件适应很好, 但重rebuilding很久时间,现在我一边写时还在开着机rebuilding,不过好难明,1T的硬盘无数据,还要同步这么久,现在已经6小时了,可能是配置太低造成吧.

现在还有个问题,就是如果把做软raid的2个1T盘设置成休眠不知道行不行…

Tag:

debian下的java简单安装

今天尝试了一下在debian下安装java,这样以后一边可以学习一下java,debian的系统环境是在virtualbox的虚拟机下的debian5进行,参考了网上的安装java的方法,选择最简单的一种。

vim /etc/apt/sources.list
deb http://debian.cn99.com/debian/ testing main contrib non-free

apt-get update
apt-get install sun-java6-jdk

出现的安装窗口全都选择yes, 这样一会就可以搞定了。

然后输入:java -version
这样就可以显示java 版本号了.

然后就是HelloWorld的例子

public class HelloWorld{
public static void main(String arg[]){
System.out.println(“Hello,world”);
}

}
把上述代码写到一个HelloWorld.java的文件里,然后
javac HelloWorld.java
生成HelloWorld.class
然后输入
java HelloWorld
这样就输出Hello,world了,注意文件名class的一致,即文件名是HelloWorld.java, 因为你的文件里的class是HelloWorld, 一切注意大小写.

Tag:

centos的启动服务加载和删除

废话不说了,下边是执行明令
/sbin/chkconfig –-add mysqld [在服务清单中添加mysql服务]
/sbin/chkconfig mysqld on [设置mysql服务开机启动]
/sbin/chkconfig mysqld off [设置mysql服务开机启动关闭]
/sbin/chkconfig –-del mysqld [在服务清单中清除mysql服务]

今天把家里的一部闲置机安装centos5.5 , 还是pxe安装呢!

/sbin/chkconfig –-list 列出所有服务

Tag:

nginx+php+mysql在debian下安装脚本尝试

测试是在virtualbox下的虚拟机中的,先使用virtualbox中的备份虚拟机的状态,脚本重新测试可以使用这个备份恢复到安装前的状态

apt-get update
 
apt-get install -y nginx
apt-get install -y mysql-server
apt-get install -y php5
apt-get install -y php5-mysql
apt-get install -y php5-cli
apt-get install -y php5-common
apt-get install -y php5-suhosin
 
ee=`grep "deb http://php53.dotdeb.org" /etc/apt/sources.list`
if [ -z "$ee" ] ; then
echo "deb http://php53.dotdeb.org stable all" >> /etc/apt/sources.list
fi
 
apt-get update
#apt-get install -y php5-fpm
apt-get install php5-fpm
 
file="/etc/nginx/sites-available/default"
filebk="/etc/nginx/sites-available/default.bak"
newfile="/root/nginx.default"
 
if [ -f "$file" ] ; then
sed "46,52s/includefastcgi_params/include fastcgi_params/" $file|sed "46,52s/\/scripts\$fastcgi_script_name/\/var\/www\/nginx-default\$fastcgi_script_name/”|sed "46,52s/#//" > $newfile
cp $file $filebk
rm $file
cp $newfile $file
echo "ok"
else
echo "no file"
fi

主要是为了练习bash shell语言练手的,当然也为了方便安装,当然没那个lnmp安装脚本完善,有时间慢慢完善,lnmp脚本可以拿来参考!

apt-get install -y php5-fpm这句在安装中怎样都不起作用,始终要手动.

这个脚本只是安装好最基本的,其它还是手动的!

安装后请重启主机啊!

Tag:

debian的启动服务加载和删除

今天用到的,在debian下是这样的.

update-rc.d -f apache2 defaults 加载

update-rc.d -f apache2 remove 删除

apache2 是 /etc/init.d/ 下的脚本,你加载那个就选那个加载的名称

Tag: