189 8069 5689

怎么进行suselinux文件系统扩容

怎么进行suse linux 文件系统扩容,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

成都创新互联坚持“要么做到,要么别承诺”的工作理念,服务领域包括:网站建设、网站制作、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的济阳网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!

 在系统安装的时候,由于经验不足或者是规划的问题,分区的时候往往会有一定的考虑不全面,当使用一定的时间就会发现某个分区空间严重的不足。这时我们通常会想到分区扩容,但是为了保证业务的连续性和高可用,我们需要快捷的扩容和平移应用目录,下面我们来看一个实际的扩容案例。

 背景环境:两台SUSE LINUX10企业版服务器+WAS集群(一台主节点+一台从节点)+NFS共享文件系统(basefs)

一、查看现有的分区系统

主节点:10.4.12.112

ty1:~ # df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/hda2              38G   12G   27G  99% /

udev                  7.9G   88K  7.9G   1% /dev

从节点:10.4.12.113

ty2:~ # df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/hda2              38G  7.6G   31G  20% /

udev                  7.9G   92K  7.9G   1% /dev

10.4.12.112:/basefs    38G   12G   27G  99% /basefs

现有的情况是两个主机使用一个NFS的共享文件系统。10.4.12.112是NFS的主服务器,设置了根下basefs的共享目录,而10.4.12.113是NFS的一个客户端,挂载的是112服务器上的basefs共享目录。这个BASEFS的共享目录与WEBSPHERE APPLICATION SERVER(简称WAS)集群上的应用密切相关。

二、扩容思路:挂载一个107G大小的scsi磁盘,把它单独划成一个分区,然后将basefs目录里的所有内容迁移到新的分区上,新分区挂载目录的名字仍为basefs。可以将原basefs目录改名或删除。

三、扩容实施过程:

1、建立分区

ty1:~ # fdisk -l

Disk /dev/sda: 107.3 GB, 107374182400 bytes (挂载的SCSI磁盘)

16 heads, 255 sectors/track, 51400 cylinders

Units = cylinders of 4080 * 512 = 2088960 bytes

Disk /dev/sda doesn't contain a valid partition table

Disk /dev/hda: 42.9 GB, 42949672960 bytes  (原磁盘)

255 heads, 63 sectors/track, 5221 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start         End      Blocks   Id  System

/dev/hda1               1         262     2104483+  82  Linux swap / Solaris

/dev/hda2   *         263        5221    39833167+  83  Linux

You have new mail in /var/mail/root

在SCSI磁盘上建立一个新的分区

ty1:~ # fdisk /dev/sda

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 51400.

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 /dev/sda: 107.3 GB, 107374182400 bytes

16 heads, 255 sectors/track, 51400 cylinders

Units = cylinders of 4080 * 512 = 2088960 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

First cylinder (1-51400, default 1):

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-51400, default 51400):

Using default value 51400

Command (m for help): p

Disk /dev/sda: 107.3 GB, 107374182400 bytes

16 heads, 255 sectors/track, 51400 cylinders

Units = cylinders of 4080 * 512 = 2088960 bytes

  Device Boot      Start         End      Blocks   Id  System

/dev/sda1               1       51400   104855872+  83  Linux

Partition 1 does not end on cylinder boundary.

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

格式化新建的分区

ty1:~ # mkfs.ext3 /dev/sda1

mke2fs 1.38 (30-Jun-2005)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

13107200 inodes, 26213968 blocks

1310698 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=4294967296

800 block groups

32768 blocks per group, 32768 fragments per group

16384 inodes per group

Superblock backups stored on blocks:

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

       4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done                            

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information:

done

This filesystem will be automatically checked every 20 mounts or

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

You have new mail in /var/mail/root

ty1:~ # pwd

/

ty1:~ # mkdir aaa

ty1:~ # mount /dev/sda1 /aaa

ty1:~ # df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/hda2              38G   12G   27G  99% /

udev                  7.9G   92K  7.9G   1% /dev

/dev/sda1              99G  188M   94G   1% /aaa

2、应用迁移

  停止112和113的NFS应用

#/etc/init.d/nfsserver stop

#/etc/init.d/portmap stop

停止112和113的IHS、WAS

#cd /usr/IBM/HTTPServer/bin

./adminctl  stop

./apachectl stop

#cd /usr/IBM/AppServer/profiles/AppSrv01/bin

./stopServer.sh server1

./stopNode.sh

#cd /usr/IBM/AppServer/profiles/Dmgr01/bin

./stopManager.sh

113解挂NFS  

#umount /basefs



  112主节点的WAS服务器:
  将原/BASEFS下的四个目录分别打一个TAR包,放到/AAA目录下解压还原(或通过cp -ra smap /aaa也可将目录平移并保留原有的权限和属性)
将原/BASEFS改名为其他,把/AAA目录改为/BASEFS

  112启动NFS

#/etc/init.d/portmap start

#/etc/init.d/nfsserver start

113重挂
#mount /10.4.12.112:/basefs   /basefs
启动112和113的WAS、HIS应用
启动IHS WAS

#cd /usr/IBM/HTTPServer/bin

./adminctl  start

./apachectl start

#cd /usr/IBM/AppServer/profiles/AppSrv01/bin

./startServer.sh server1

./startNode.sh

#cd /usr/IBM/AppServer/profiles/Dmgr01/bin

  ./startManager.sh

三、验证测试

1、df –h验证分区扩容是否正常

ty1:~ # df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/hda2              38G   12G   27G  29% /

udev                  7.9G   92K  7.9G   1% /dev

/dev/sda1              99G   25G   74G   25% /basefs

ty2:~ # df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/hda2              38G  7.6G   31G  20% /

udev                  7.9G   92K  7.9G   1% /dev

10.4.12.112:/basefs     99G   25G   74G   25% /basefs

2、应用开发人员测试程序是否正常

3、不正常则停止应用改回原BASEFS目录进行回退

  最后经验证,一切正常,扩容成功。

关于怎么进行suse linux 文件系统扩容问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注创新互联行业资讯频道了解更多相关知识。


当前名称:怎么进行suselinux文件系统扩容
分享网址:http://jkwzsj.com/article/jphpii.html

其他资讯