老服务器新增SCSI硬盘,挂载之

PIII CPU的老服务器,192MB 内存,系统在IDE 盘上(6G多)。昨天新加了两块SCSI 硬盘,一块4G的(sdc),另一块是18G(sdb)的。
我主要用来作FTP服务器和WWW服务器,因此,/home目录和 /var 目录要大一点。
4G那个就挂载到 /var 吧,18G那个挂载到 /home .
先分区。
看下新加的盘的名字:

1
ls /dev/sd*


磁盘的分区与格式化在这里就不说了。下面是在前面已经分好区的基础上操作的。

看下盘的大小 :

1
2
3
4
5
6
7
8
9
10
11
root@hywd:/var/run# fdisk -l /dev/sdb

Disk /dev/sdb: 18.4 GB, 18373206016 bytes
255 heads, 63 sectors/track, 2233 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x7af47af4

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        2234    17942552+  83  Linux
1
2
3
4
5
6
7
8
9
10
11
root@hywd:/var/run# fdisk -l /dev/sdc

Disk /dev/sdc: 4335 MB, 4335206400 bytes
255 heads, 63 sectors/track, 527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xfec9061f

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         527     4233096   83  Linux

先把原来里面的东东COPY到相应的盘:

1
2
3
4
5
6
7
8
mkdir /mnt/sdb
mount /dev/sdb1 /mnt/sdb
mkdir /mnt/sdc
mount /dev/sdc1 /mnt/sdc
cp -R /var/* /mnt/sdc
cp -R /home/* /mnt/sdb
umount /dev/sdb1
umount /dev/sdc1

然后开始挂载吧。其实这时要停掉mysql ,ftp 这些服务:

1
service mysql stop

查看相应分区的UUID :

1
2
3
4
5
root@hywd:/var/run# blkid
/dev/sda1: UUID="dcfe6913-1aa6-4ac4-be25-92aa377c33ad" TYPE="ext4"
/dev/sda5: UUID="7389461d-ccd0-412a-bbad-7fe777f653c9" TYPE="swap"
/dev/sdb1: UUID="adc135a9-3f29-4d84-820f-c7253e466104" TYPE="ext4"
/dev/sdc1: UUID="2e63c18b-d6ae-4799-b80e-fb00f5200eb5" TYPE="ext4"

如果只要查看UUID:

1
2
3
4
5
root@hywd:/var/run# blkid -o value -s UUID
dcfe6913-1aa6-4ac4-be25-92aa377c33ad
7389461d-ccd0-412a-bbad-7fe777f653c9
adc135a9-3f29-4d84-820f-c7253e466104
2e63c18b-d6ae-4799-b80e-fb00f5200eb5

然后编辑fstab

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
root@hywd:/var/run# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda1 during installation
UUID=dcfe6913-1aa6-4ac4-be25-92aa377c33ad /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=7389461d-ccd0-412a-bbad-7fe777f653c9 none            swap    sw              0       0

# /var was on /dev/sdc1
UUID=2e63c18b-d6ae-4799-b80e-fb00f5200eb5 /var      ext4    defaults    00

# /home was on /dev/sdb1
UUID=adc135a9-3f29-4d84-820f-c7253e466104 /home     ext4    defaults    00

完了以后保存,最后挂载之:

1
mount -a

看下结果:

1
2
3
4
5
6
7
8
9
10
root@hywd:~# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             5.7G  1.6G  3.9G  29% /
none                   87M  160K   87M   1% /dev
none                   91M     0   91M   0% /dev/shm
none                   91M   36K   91M   1% /var/run
none                   91M     0   91M   0% /var/lock
none                   91M     0   91M   0% /lib/init/rw
/dev/sdb1              17G  637M   16G   4% /home
/dev/sdc1             4.0G  284M  3.5G   8% /var

没有 发现mysql 服务。。。囧

1
2
3
4
5
6
7
8
9
root@hywd:~# netstat -tuln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 0.0.0.0:3690            0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:1723            0.0.0.0:*               LISTEN    
tcp6       0      0 :::22                   :::*                    LISTEN

执行/usr/sbin/mysqld 发现提示目录没有权限

于是修改之:

1
2
3
chown -R mysql:mysql /var/lib/mysql
root@hywd:/var/run# ls -ldh /var/lib/mysql
drwx------ 5 mysql mysql 4.0K 2011-01-05 13:28 /var/lib/mysql

还有这个目录的权限也要修改下:

1
chown -R mysql:root  /var/run/mysqld/
1
2
root@hywd:/var/run# ls -ldh /var/run/mysqld/
drwxr-xr-x 2 mysql root 60 2011-01-05 12:59 /var/run/mysqld/

再看下:

1
2
3
4
5
6
7
8
9
10
root@hywd:/var/run# netstat -tuln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:3690            0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:1723            0.0.0.0:*               LISTEN    
tcp6       0      0 :::22                   :::*                    LISTEN

重启下(mysql重启的速度相当慢。。。。可能是服务器太老):

1
2
root@hywd:/var/run# service mysql restart
mysql start/running, process 5482
更多
No Responses Post a comment

Leave a Reply

Note: You may use basic HTML in your comments. Your email address will not be published.

Subscribe to this comment feed via RSS