您好,登錄后才能下訂單哦!
怎么進行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 文件系統擴容問題的解答就分享到這里了,希望以上內容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注億速云行業資訊頻道了解更多相關知識。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。