国产宅男网站在线|亚洲A级性爱免费视频|亚洲中精品级在线|午夜福利AA毛

  • <dd id="gf5jf"><th id="gf5jf"></th></dd>

    <cite id="gf5jf"><label id="gf5jf"></label></cite>
  • <div id="gf5jf"><listing id="gf5jf"></listing></div>
    學(xué)習(xí)啦 > 學(xué)習(xí)電腦 > 操作系統(tǒng) > Linux教程 > Linux更改VirtualBox磁盤容量的方法

    Linux更改VirtualBox磁盤容量的方法

    時(shí)間: 孫勝652 分享

    Linux更改VirtualBox磁盤容量的方法

      VirtualBox是一款虛擬機(jī),在Linux系統(tǒng)使用過(guò)程中會(huì)遇到VirtualBox虛擬機(jī)磁盤空間不夠用的問(wèn)題,遇到這種問(wèn)題該如何解決呢?下面小編就教大家Linux如何更改VirtualBox虛擬機(jī)的磁盤容量。

      1.啟動(dòng)CMD命令行,進(jìn)入VirtualBox的安裝目錄。如

      cd E:\Program Files\Oracle\VirtualBox

      2.查看需要修改的虛擬硬盤:

      E:\Program Files\Oracle\VirtualBox》VBoxManage.exe list hdds

      UUID: e8e2c341-b3b1-49db-ad2d-ab4e6b08bc5a

      Parent UUID: base

      State: locked write

      Type: normal (base)

      Location: F:\VM\CentOS-64.vdi

      Storage format: VDI

      Capacity: 8000 MBytes

      UUID: 707d45b6-380d-4e51-96bd-8c9508bfd313

      Parent UUID: base

      State: created

      Type: normal (base)

      Location: F:\VM\CentOS-64-ext.vdi

      Storage format: VDI

      Capacity: 21273 MBytes

      UUID: aca81637-fbc0-4826-be66-847ecc96d83b

      Parent UUID: base

      State: created

      Type: normal (base)

      Location: C:\Users\Edward.Wu\VirtualBox VMs\WinXP\WinXP.vdi

      Storage format: VDI

      Capacity: 10240 MBytes

      ----

      我們看到共有三個(gè)虛擬磁盤,我們要修改圖中第一個(gè),它的空間大小為8G,UUID:e8e2c341-b3b1-49db-ad2d-ab4e6b08bc5a

      3. 調(diào)整磁盤空間為15G:

      E:\Program Files\Oracle\VirtualBox》VBoxManage.exe modifyhd e8e2c341-b3b1-49db-ad2d-ab4e6b08bc5a --resize 150000%.。.10%.。.20%.。.30%.。.40%.。.50%.。.60%.。.70%.。.80%.。.90%.。.100%

      重新查看:

      E:\Program Files\Oracle\VirtualBox》VBoxManage.exe list hdds UUID: e8e2c341-b3b1-49db-ad2d-ab4e6b08bc5a Parent UUID: base State: locked write Type: normal (base) Location: F:\VM\CentOS-64.vdi Storage format: VDI Capacity: 15000 MBytes

      UUID: 707d45b6-380d-4e51-96bd-8c9508bfd313 Parent UUID: base State: created Type: normal (base) Location: F:\VM\CentOS-64-ext.vdi Storage format: VDI Capacity: 21273 MBytes

      UUID: aca81637-fbc0-4826-be66-847ecc96d83b Parent UUID: base State: created Type: normal (base) Location: C:\Users\Edward.Wu\VirtualBox VMs\WinXP\WinXP.vdi Storage format: VDI Capacity: 10240 MBytes

      4.查看新的磁盤空間

      重新啟動(dòng)虛擬機(jī),查看磁盤情況。

      [root@aimin ~]# fdisk -l /dev/sda

      Disk /dev/sda: 15.7 GB, 15728640000 bytes 255 heads, 63 sectors/track, 1912 cylinders

      可以看到磁盤空間已經(jīng)擴(kuò)展到15G,但這時(shí)還不可以使用。

      5.Enable新增加的空間

      使用 fdisk 將虛擬磁盤的空閑空間創(chuàng)建為一個(gè)新的分區(qū)。注意要使用代表 Linux LVM 的分區(qū)號(hào) 8e 來(lái)作為 ID。

      # fdisk /dev/sda

      n {new partition}

      p {primary partition}

      3 {partition number}

      [這時(shí)會(huì)提示修改大小,選擇默認(rèn)直接回車即可]

      t {change partition id}

      3 {partition number}

      8e {Linux LVM partition}

      w

      ------

      如果中間有設(shè)置大小之類的提示,就直接回車。

      完成后,如果提示:

      WARNING: Re-reading the partition table failed with error 16: 設(shè)備或資源忙。 The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8)

      就重啟一下系統(tǒng)。

      6.查看新增加的sda3是否標(biāo)記為L(zhǎng)VM,如果沒(méi)有需要reboot

      #fdisk -l /dev/sda

      7.調(diào)整LVM大小

      先看一下Volume Group名稱

      [root@aimin ~]# vgdisplay --- Volume group --- VG Name vg_aimin

      。。.。

      vg_aimin是我的VolumeGroup的名稱,實(shí)際操作時(shí),需要使用實(shí)際顯示的名稱。

      8.把新分配的空間創(chuàng)建一個(gè)新的物理卷

      #pvcreate /dev/sda3

      9.然后使用新的物理卷來(lái)擴(kuò)展 LVM 的 VolGroup,

      # vgextend vg_aimin /dev/sda3

      No physical volume label read from /dev/sda3

      Writing physical volume data to disk “/dev/sda3”

      Physical volume “/dev/sda3” successfully created

      Volume group “vg_aimin” successfully extended

      10.然后擴(kuò)展 LVM 的邏輯卷 vg_aimin-lv_root,

      # lvextend /dev/vg_aimin/lv_root /dev/sda3

      11.調(diào)整邏輯卷的大小

      #resize2fs /dev/vg_aimin/lv_root

      到這里就完成了空間的擴(kuò)展。

      12.查看效果

      [root@aimin ~]# df -h文件系統(tǒng) 容量 已用 可用 已用%% 掛載點(diǎn)/dev/mapper/vg_aimin-lv_root 12G 5.2G 6.2G 46% /tmpfs 499M 80K 499M 1% /dev/shm/dev/sda1 485M 33M 427M 8% /boot

      成功擴(kuò)展!!!

      上面就是Linux修改VirtualBox虛擬機(jī)磁盤容量的方法介紹了,首先使用命令行進(jìn)入VirtualBox虛擬機(jī)的安裝目錄,在找到相應(yīng)文件進(jìn)行磁盤大小的修改。

    317864