溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

怎么進行suse linux 文件系統(tǒng)擴容

發(fā)布時間:2021-10-21 18:04:48 來源:億速云 閱讀:515 作者:柒染 欄目:云計算

怎么進行suse linux 文件系統(tǒng)擴容,針對這個問題,這篇文章詳細介紹了相對應(yīng)的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。

 在系統(tǒng)安裝的時候,由于經(jīng)驗不足或者是規(guī)劃的問題,分區(qū)的時候往往會有一定的考慮不全面,當(dāng)使用一定的時間就會發(fā)現(xiàn)某個分區(qū)空間嚴重的不足。這時我們通常會想到分區(qū)擴容,但是為了保證業(yè)務(wù)的連續(xù)性和高可用,我們需要快捷的擴容和平移應(yīng)用目錄,下面我們來看一個實際的擴容案例。

 背景環(huán)境:兩臺SUSE LINUX10企業(yè)版服務(wù)器+WAS集群(一臺主節(jié)點+一臺從節(jié)點)+NFS共享文件系統(tǒng)(basefs)

一、查看現(xiàn)有的分區(qū)系統(tǒng)

主節(jié)點: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

從節(jié)點: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

現(xiàn)有的情況是兩個主機使用一個NFS的共享文件系統(tǒng)。10.4.12.112是NFS的主服務(wù)器,設(shè)置了根下basefs的共享目錄,而10.4.12.113是NFS的一個客戶端,掛載的是112服務(wù)器上的basefs共享目錄。這個BASEFS的共享目錄與WEBSPHERE APPLICATION SERVER(簡稱WAS)集群上的應(yīng)用密切相關(guān)。

二、擴容思路:掛載一個107G大小的scsi磁盤,把它單獨劃成一個分區(qū),然后將basefs目錄里的所有內(nèi)容遷移到新的分區(qū)上,新分區(qū)掛載目錄的名字仍為basefs??梢詫⒃璪asefs目錄改名或刪除。

三、擴容實施過程:

1、建立分區(qū)

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磁盤上建立一個新的分區(qū)

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.

格式化新建的分區(qū)

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、應(yīng)用遷移

  停止112和113的NFS應(yīng)用

#/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主節(jié)點的WAS服務(wù)器:
  將原/BASEFS下的四個目錄分別打一個TAR包,放到/AAA目錄下解壓還原(或通過cp -ra smap /aaa也可將目錄平移并保留原有的權(quán)限和屬性)
將原/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應(yīng)用
啟動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驗證分區(qū)擴容是否正常

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、應(yīng)用開發(fā)人員測試程序是否正常

3、不正常則停止應(yīng)用改回原BASEFS目錄進行回退

  最后經(jīng)驗證,一切正常,擴容成功。

關(guān)于怎么進行suse linux 文件系統(tǒng)擴容問題的解答就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關(guān)注億速云行業(yè)資訊頻道了解更多相關(guān)知識。

向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI