# 這個參考資料 # http://blog.cowbay.org/rewrite.php/read-213.html # 我做到使用rescue光碟片,做重抓的動作,OS是centos44 # 光碟片我用3.3的,發現抓不到lvm,後來換centos44就可以了 # # 這次測試,是新增一顆硬碟,分割了以後,把type改成8e(LVM) # 然後建立PV ==> 擴充VG ==> 擴充LV # 目的是在根目錄(/)擴充空間 # # 這個方式是失敗的: # 縮小LV01,利用空出來的VG空間,在建立一個新的LV02 # 在用rescue模式,執行resize更改大小,會出現以下的錯誤訊息 # e2fsck -f /dev/VolGroup00/LogVol00 # The Filesystem size (according to the superblock) is 745472 blocks # The physical size of the device is 655360 blocks # Either the superblock or the partition table is likely to be corrupt! # Abort? 這些測試,我是在VMware上做的,所以剛開始我必需先擴充vmdk的容量 我是使用Free VMware Server,我想利用command-line的方式(也可以用GUI新增) 原先是3G,我想增加到4G的空間 cd C:\Program Files\VMware\VMware Server vmware-vdiskmanager -x 4GB d:\os\centos44\Red Hat Enterprise Linux 4.vmdk 開機開完後,用fdisk建立分割區 fdisk /dev/sda command: m(先看一下指令的說明) p(顯示目前的分割狀態,很像spfdisk) n(建立分割區) p(建立主要分割區) 3(建立編號為多少的分割區,視情況) 先按enter跳過輸入cylinder的起始值, 在結束值的地方按+size or +sizeM or +sizeG(例如+512M) +1G t(更改分割區type) 3(選擇編號為多少的分割區,視情況) 8e(這個是LVM的type) w(存檔) 讀取最新的partition table, 打這個指令就不用重開機了 partprobe 看一下目前有哪些PV pvscan or pvdisplay 建立PV pvcreate /dev/sda3(視情況) 看一下目前有哪些VG vgscan or vgdisplay 把剛才那個PV加入現行的VG行列中,並擴充VG vgextend VolGroup00 /dev/sda3(視情況) 擴充LV lvextend -L +1G /dev/VolGroup00/LogVol00(視情況) 光碟片重新開機後,按[F5],然後打linux rescue 因為目前是對根目錄所在的磁碟擴充,所以要用開機片來做resize的動作 先看一下系統目前有哪些VG,可以看到是沒有ACTIVE的 lvm vgscan 打以下這個指令,就可以把VG ACTIVE,這樣才可以resize它 lvm vgchange --available y VolGroup00 # 當打以上那個指令以後,VolGroup00會在/dev裡面show出來 lvm lvscan 要先做fsck,檢查檔案系統 e2fsck -f /dev/VolGroup00/LogVol00 告訴系統,分割區大小有調整了,以下以實際情況為主 resize2fs /dev/VolGroup00/LogVol00 離開rescue模式,不是reboot或是shutdown哦 exit # +--------------------------------------+ # |接下來要測試另外一種的。縮小LV........| # |縮小的方式就是反方向,................| # |先用resize2fs把filesystem分割區縮小,.| # |然後把LV的空間縮小....................| # +--------------------------------------+ http://smallken.no-ip.org/blog/2007/07/18/linux/330.html # 跟增加容量一樣,要先做fsck,檢查檔案系統 e2fsck -f /dev/VolGroup00/LogVol00 # 先縮小filesystem分割區,這裡的例子是縮小成5G # (可以打其他的單位,請看man說明,關於size的部份) # the size parameter may be suffixed by one of the following the units # designators: 's', 'K', 'M', or 'G', for 512 byte sectors, kilobytes, # megabytes, or gigabytes, respectively. The size of the filesystem may # never be larger than the size of the partition. If size parameter is not # specified, it will default to the size of the partition. resize2fs /dev/Volgroup00/LogVol00 5G # 把LV的空間縮小 # 重新mount或是重開機就可以生效了 lvresize /dev/Volgroup00/LogVol00 -L 5G # 參考資料 # 當然這個東西少不了鳥哥 http://linux.vbird.org/linux_basic/0610hardware.php 做的還蠻順利的,多做幾次就熟了 下次換做建立另一個群組,在另一個群組建立/disk1
文章標籤
全站熱搜
創作者介紹
創作者 付爸爸 的頭像
付爸爸

付爸爸的神奇日記本

付爸爸 發表在 痞客邦 留言(0) 人氣(6,388)