SUSE LINUX Enterprise & openSUSE Community
มกราคม 18, 2019, 05:26:45 AM *
ยินดีต้อนรับคุณ, บุคคลทั่วไป กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน
ส่งอีเมล์ยืนยันการใช้งาน?

เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น
ข่าว:
 
   หน้าแรก   ช่วยเหลือ ค้นหา เข้าสู่ระบบ สมัครสมาชิก  

[Why we need your support] SUSE and openSUSE are trademarks of Attachmate Group, Inc. - WE ARE NOT IN ANY WAY ASSOCIATED WITH SUSE AND ATTACHMATE GROUP. SUSEThailand.com is a SUSE Linux user and community found in Thailand but not limited to other country suse linux user to join in. Currently active contents (How to's, Scripts, Tips, Tricks, Tutorials, Linux Command Line, and Troubleshooting) this suse linux how to's and expert support are SUSE Linux.
หน้า: [1]   ลงล่าง
  พิมพ์  
ผู้เขียน
หัวข้อ: Adding a New Disk Into an Existing Logical Volume  (อ่าน 948 ครั้ง)
0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้
Sontaya
Administrator
Expert : ผู้เชี่ยวชาญ
*****

Karma: +1/-0
ออฟไลน์ ออฟไลน์

กระทู้: 1931


Administrator


เว็บไซต์
« เมื่อ: พฤษภาคม 21, 2013, 08:52:36 AM »


Adding a New Disk Into an Existing Logical Volume

Environment
SUSE Linux Enterprise Server 11 All Service Packs
SUSE Linux Enterprise Server 10 All Service Packs


Situation
   A volume that is managed by LVM has filled up.  It is not possible to free up any additional space.  New space is needed in order to keep the server stable and running. 


Resolution
   It will be assumed in this case that a logical volume 'data' is full and needs to be expanded.  The device mapper path to the volume is /dev/serverdata/data.  It will also be assumed that the new disk is detected by device mapper as /dev/sdb.  Also, it is assumed that an ext2 or ext3 filesystem is used.  If another filesystem type is used, the below should be pertinent up until the fsck and file system resize command.
 
As with any filesystem change, back up any pertinent data first.  If the machine is a VM, a full snapshot is recommended.

1. Power down server and add new hard disk to server.

2. Power on server and log in

3. Unmount data logical volume

โค๊ด:
umount /dev/serverdata/data

4. Add new disk to a physical volume

โค๊ด:
pvcreate /dev/sdb

5. Add the new physical volume to the volume group

โค๊ด:
vgextend serverdata /dev/sdb

6. Extend the logcial volume to use the new space allocated

โค๊ด:
lvextend -l +100%FREE /dev/serverdata/data

NOTE: The lvextend command is a very versatile command.  The above syntax will expand data to use all free space in it volume group.  It is possible to merely add a set amount of space, or set the logical volume to a specific size.  If further information is needed on the above command, please refer to the man page for lvextend.

7. Check the file system integrity

โค๊ด:
e2fsck -f /dev/serverdata/data

8. Extend the partition to use the full space

โค๊ด:
resize2fs /dev/serverdata/data

NOTE: Once again with the resize2fs command, this is a very versatile command.  Without using any switches, resize2fs will extend the partition to the size of the underlying logical volume.  It is possible to grow or shrink the partition to whatever size is needed, but for this information please look at the man page for resize2fs.

9. This last step is not specifically needed, and my be omitted if desired, but is considered best practice to ensure data and file system integrity.  File system check the file system again.

โค๊ด:
e2fsck -f /dev/serverdata/data


Additional Information
   In order to manage logical volumes and partitions, the volume must be unmounted.  If the root partition is full, the only way to do this is to boot off of the SLES media and enter into rescue mode.
 
When in rescue mode, it will be necessary to activate LVM first before you can manage logical volumes.  To activate LVM in rescue mode:
 
1) pvscan
2) vgscan
3) lvscan
 
These command will activate and display all physical volumes, volume groups, and logical volumes.  Paths for working volumes will be printed out to the screen.

Reference - TID
แจ้งลบกระทู้นี้หรือติดต่อผู้ดูแล   บันทึกการเข้า

ageLOC Technology
หน้า: [1]   ขึ้นบน
  พิมพ์  
 
กระโดดไป:  

(@)2007 SUSE Linux user community found in Thailand. This site is not an official openSUSE and SUSE website, and is not in any way affiliated with or endorsed by SUSE Linux GmbH or Novell. openSUSE and SUSE are trademarks of Novell, Inc. in the United States and other countries.
Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!
หน้านี้ถูกสร้างขึ้นภายในเวลา 0.025 วินาที กับ 19 คำสั่ง (Pretty URLs adds 0.006s, 2q)