Chinaunix首页 | 论坛 | 博客
  • 博客访问: 284290
  • 博文数量: 69
  • 博客积分: 3370
  • 博客等级: 中校
  • 技术积分: 1035
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-25 10:52
文章分类

全部博文(69)

文章存档

2019年(1)

2009年(7)

2008年(61)

我的朋友

分类:

2008-06-30 18:46:39

DELL 1850 服务器配置:
至强3.0GHZ *2
4G ECC DDR内存
73G SCSI Utrl 320 15K 硬盘 *2

目标

1.   根据实际需要发现系统的日志空间不够大

2.   由于新加了内存等等,系统的swap分区需要加大

 

实际操作:

 

1.       关机安装好硬盘

 确保在开机BIOS时能看到该设备

进系统。

[root@localhost ~]# ls /dev|grep sdb  -(这里假设原设备只有一块SCSI硬盘,现在添加一块)

sdb

 

现在开始给新磁盘分区:

[root@localhost dev]# fdisk sdb

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel. Changes will remain in memory only,

until you decide to write them. After that, of course, the previous

content won't be recoverable.

 

 

The number of cylinders for this disk is set to 8924.

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)

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

 

Command (m for help): p        (该处命令可以看出,新硬盘没有liunx分区)

 

Disk sdb: 73.4 GB, 73407820800 bytes

255 heads, 63 sectors/track, 8924 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

Device Boot      Start         End      Blocks   Id  System

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

Command (m for help): n        (创建新分区)

Command action

   e   extended

   p   primary partition (1-4)

p                           (创建主分区)

Partition number (1-4): 1        (主分区号为1

First cylinder (1-8924, default 1): 1     (设置分区大小,从第一扇区开始,默认)

Last cylinder or +size or +sizeM or +sizeK (1-8924, default 8924): +20g   (设置分区大小)

 

Command (m for help): n        (创建新分区)

Command action

   e   extended

   p   primary partition (1-4)

p                           (创建主分区)

Partition number (1-4): 2        (主分区号为2

First cylinder (2434-8924, default 2434):    (设置分区大小,默认)

Using default value 2434

Last cylinder or +size or +sizeM or +sizeK (2434-8924, default 8924): +1g  (设置分区大小)

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.

[root@localhost dev]# fdisk sdb

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel. Changes will remain in memory only,

until you decide to write them. After that, of course, the previous

content won't be recoverable.

 

 

The number of cylinders for this disk is set to 8924.

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)

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

 

Command (m for help): p        (该处命令可以看出,新硬盘分好了两个区)

 

Disk sdb: 73.4 GB, 73407820800 bytes

255 heads, 63 sectors/track, 8924 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1        2433    19543041   83  Linux

/dev/sdb2            2434        2556      987997+  83  Linux 

+表示分区实际大小大于1G,因为分区大小实际上是按照)柱面划分的

 

sdb1分区创建成liunx分区

[root@localhost dev]# mkfs.ext3 /dev/sdb1

mke2fs 1.39 (29-May-2006)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

2443200 inodes, 4885760 blocks

244288 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=0

150 block groups

32768 blocks per group, 32768 fragments per group

16288 inodes per group

Superblock backups stored on blocks:

        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

        4096000

 

Writing inode tables: done                           

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

 

This filesystem will be automatically checked every 30 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

[root@localhost dev]#

 

/var/log目录下的日志文件等等,备份。

由于新的文件系统挂载到现有的目录下,会覆盖掉原目录下原有的文件。

sdb1挂载到/var/log目录。

[root@localhost dev]#mount /dev/sdb1 /var/log

恢复日志文件到/var/log目录

 

sdb2创建为swap分区

[root@localhost log]# mkswap -c /dev/sdb2

Setting up swapspace version 1, size = 1011703 kB

 

将新的swap分区挂载使用

[root@localhost log]# swapon /dev/sdb2

OK

可以参看新的awap是否起用了:

[root@localhost log]# cat /proc/swaps

Filename                                Type            Size    Used    Priority

/dev/sda6                               partition       2096440 0       -1

/dev/sdb2                               partition       987988  0       -2

 

修改/etc/fstab 以使新分区开机自动加载

LABEL=/                 /                     ext3    defaults         1 1

devpts                  /dev/pts                 devpts  gid=5,mode=620  0 0

tmpfs                   /dev/shm                tmpfs   defaults         0 0

LABEL=/home           /home                  ext3    defaults         1 2

proc                    /proc                   proc    defaults         0 0

sysfs                    /sys                   sysfs   defaults          0 0

LABEL=/tmp            /tmp                    ext3    defaults         1 2

LABEL=/usr             /usr                    ext3    defaults         1 2

LABEL=/var             /var                    ext3    defaults         1 2

/dev/sdb1                /var/log                ext3    defaults         1 2

LABEL=SWAP-sda6       swap                  swap    defaults        0 0

/dev/sdb2                swap                  swap    defaults         0 0

阅读(1230) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~