日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
虛擬機(jī)磁盤(pán)邏輯卷如何擴(kuò)容

虛擬機(jī)磁盤(pán)邏輯卷如何擴(kuò)容

作者:gnix 2018-07-31 13:51:16

云計(jì)算

虛擬化 空間不太夠,所以在虛擬機(jī)上把分配磁盤(pán)空間擴(kuò)大的20GB。在esx server上擴(kuò)容磁盤(pán)空間的方法很簡(jiǎn)單,在此不提,下面具體說(shuō)說(shuō)如何把該擴(kuò)容的磁盤(pán)空間在虛擬機(jī)上應(yīng)用上去。

專注于為中小企業(yè)提供成都網(wǎng)站設(shè)計(jì)、網(wǎng)站制作服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)長(zhǎng)垣免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動(dòng)了成百上千家企業(yè)的穩(wěn)健成長(zhǎng),幫助中小企業(yè)通過(guò)網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。

在esx server上安裝虛擬機(jī)時(shí),由于只分配了默認(rèn)的8GB磁盤(pán)空間??臻g不太夠,所以在虛擬機(jī)上把分配磁盤(pán)空間擴(kuò)大的20GB。在esx server上擴(kuò)容磁盤(pán)空間的方法很簡(jiǎn)單,在此不提,下面具體說(shuō)說(shuō)如何把該擴(kuò)容的磁盤(pán)空間在虛擬機(jī)上應(yīng)用上去。

 以下是未擴(kuò)容前的狀態(tài):

  
 
 
 
  1. [root@localhost ~]# fdisk -l
  2. Disk /dev/sda: 21.4 GB, 21474836480 bytes
  3. 255 heads, 63 sectors/track, 2610 cylinders
  4. Units = cylinders of 16065 * 512 = 8225280 bytes
  5.    Device Boot      Start         End      Blocks   Id  System
  6. /dev/sda1   *           1          13      104391   83  Linux
  7. /dev/sda2              14        1044     8281507+  8e  Linux LVM
  8.  
  9. [root@localhost ~]# df -h
  10. Filesystem            Size  Used Avail Use% Mounted on
  11. /dev/mapper/VolGroup-LogVol00
  12.                       7.0G  4.8G  1.8G  73% /
  13. /dev/sda1              99M   12M   82M  13% /boot
  14. tmpfs                 187M     0  187M   0% /dev/shm
  15. /dev/hdc              183M  183M     0 100% /media/VMware Tools

可以看到sda有21.4GB,但是只利用了sda1和sda2;根目錄掛載在/dev/mapper/VolGroup-LogVol00,我們要做的是,把sda上剩余的空間擴(kuò)容到/dev/mapper/VolGroup-LogVol00。

1)首先,通過(guò)fdisk /dev/sda命令將sda剩余空間創(chuàng)建一個(gè)分區(qū):

  
 
 
 
  1. [root@localhost ~]# fdisk /dev/sda
  2. The number of cylinders for this disk is set to 2610.
  3. There is nothing wrong with that, but this is larger than 1024,
  4. and could in certain setups cause problems with:
  5. 1) software that runs at boot time (e.g., old versions of LILO)
  6. 2) booting and partitioning software from other OSs
  7.    (e.g., DOS FDISK, OS/2 FDISK)
  8. Command (m for help): m
  9. Command action
  10.    a   toggle a bootable flag
  11.    b   edit bsd disklabel
  12.    c   toggle the dos compatibility flag
  13.    d   delete a partition
  14.    l   list known partition types
  15.    m   print this menu
  16.    n   add a new partition
  17.    o   create a new empty DOS partition table
  18.    p   print the partition table
  19.    q   quit without saving changes
  20.    s   create a new empty Sun disklabel
  21.    t   change a partition's system id
  22.    u   change display/entry units
  23.    v   verify the partition table
  24.    w   write table to disk and exit
  25.    x   extra functionality (experts only)
  26. Command (m for help): n
  27. Command action
  28.    e   extended
  29.    p   primary partition (1-4)
  30. p
  31. Partition number (1-4): 3
  32. First cylinder (1045-2610, default 1045):
  33. Using default value 1045
  34. Last cylinder or +size or +sizeM or +sizeK (1045-2610, default 2610):
  35. Using default value 2610
  36. Command (m for help): w
  37. The partition table has been altered!
  38. Calling ioctl() to re-read partition table.
  39. WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
  40. The kernel still uses the old table.
  41. The new table will be used at the next reboot.
  42. Syncing disks.
  43. [root@localhost ~]#

此時(shí)可以看到多了一個(gè)sda3的分區(qū):

  
 
 
 
  1. [root@localhost ~]# fdisk -l
  2. Disk /dev/sda: 21.4 GB, 21474836480 bytes
  3. 255 heads, 63 sectors/track, 2610 cylinders
  4. Units = cylinders of 16065 * 512 = 8225280 bytes
  5.    Device Boot      Start         End      Blocks   Id  System
  6. /dev/sda1   *           1          13      104391   83  Linux
  7. /dev/sda2              14        1044     8281507+  8e  Linux LVM
  8. /dev/sda3            1045        2610    12578895   83  Linux

此時(shí)查看了一下/dev下,不知道為何沒(méi)有/dev/sda3,于是重啟了一下虛擬機(jī)RHEL,重啟完成后,出現(xiàn)了/dev/sda3.

一開(kāi)始在這個(gè)地方折騰了一會(huì),如果不重啟,在利用命令pvcreate /dev/sda3創(chuàng)建pv時(shí),總是提示Device /dev/sda3 not found (or ignored by filtering).

重啟完成后,進(jìn)入lvm模式,創(chuàng)建pv:

  
 
 
 
  1. lvm> pvcreate /dev/sda3
  2.   Physical volume "/dev/sda3" successfully created

擴(kuò)容vg:vgextend vg_gcc /dev/sda3

  
 
 
 
  1. lvm> vgextend VolGroup /dev/sda3
  2.   /dev/cdrom: open failed: Read-only file system
  3.   Attempt to close device '/dev/cdrom' which is not open.
  4.   Volume group "VolGroup" successfully extended

把lv擴(kuò)容到vg的剩余容量:lvextend /dev/vg_gcc/lv_root /dev/sda3

  
 
 
 
  1. lvm> lvextend /dev/VolGroup/LogVol00 /dev/sda3
  2.   Extending logical volume LogVol01 to 12.72 GB
  3.   Logical volume LogVol01 successfully resized

***,通過(guò)resize2fs命令令新增的空間在線(on-line)生效:resize2fs /dev/vg_gcc/lv_root

  
 
 
 
  1. [root@localhost dev]# resize2fs /dev/VolGroup/LogVol00 
  2. resize2fs 1.39 (29-May-2006)
  3. Filesystem at /dev/VolGroup/LogVol00 is mounted on /; on-line resizing required
  4. Performing an on-line resize of /dev/VolGroup/LogVol00 to 5005312 (4k) blocks.
  5. The filesystem on /dev/VolGroup/LogVol00 is now 5005312 blocks long.

效果如下:

  
 
 
 
  1. [root@localhost dev]# df -h
  2. Filesystem            Size  Used Avail Use% Mounted on
  3. /dev/mapper/VolGroup-LogVol00
  4.                        19G  4.8G   13G  28% /
  5. /dev/sda1              99M   12M   82M  13% /boot
  6. tmpfs                 187M     0  187M   0% /dev/shm
  7. /dev/hdc              3.4G  3.4G     0 100% /media/RHEL_5.2 x86_64 DVD

 至此,擴(kuò)容已成功完成。


本文題目:虛擬機(jī)磁盤(pán)邏輯卷如何擴(kuò)容
文章源于:http://www.dlmjj.cn/article/coddcgi.html