今天查看學校的監控報修系統,不能訪問了!!!系統運行很慢,用top命令查看發現內存使用率90%,用"df -h ”查看“/”目錄使用率已達到80%,導致系統運行很慢.我用以下方法擴大根目錄磁碟空間.
一、關閉你的虛擬機系統,找到如下內容:選擇"Edit Virtual mache settings”
點擊"Expand“
擴大虛擬機的空間為"40G"(根據個人需要填寫空間大小).但是linux下面並不可見.
二、使用linux下的fdisk工具進行分區.
用root用戶登錄到你的linux系統,查看你系統的分區
#fdisk -l
會出現以下的信息:
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
/dev/sda2 64 2611 20458496 8e Linux LVM
Disk /dev/mapper/vg_zxw-lv_root: 18.8 GB, 18832424960 bytes
255 heads, 63 sectors/track, 2289 cylinders
#fdisk /dev/sda/
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help):m //“ 列出fdisk的幫助”
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
Partition number (1-4):3 //fdisk會讓你選擇主分區的編號,如果已經有了主分區sda1,sda2,那麼編號就選3,即要創建的該分區為sda3.
First cylinder (2611-3916, default 2611): //此時,fdisk又會讓你選擇該分區的開始值這個就是分區的Start 值(start cylinder);這裡最好直接按回車,
Using default value 2611
Last cylinder, cylinders or size{K,M,G} (2611-3916, default 3916): //此時,fdisk又會讓你選擇該分區的開始值這個就是分區的End 值這裡最好直接按回車,
Using default value 3916
Command (m for help): w //w "保存所有並退出,分區劃分完畢"
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
Partition number (1-4): 3 //指定分區號
Hex code (type L to list codes): 8e //指定要改成的id號,8e代表LVM.
Command (m for help): w
四、重啟系統后,登陸系統.(一定要重啟系統,否則無法擴充新分區)
五、格式化該新添加的分區:
#fdisk -l
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
--- Volume group ---
Logical volume LogVol00 successfully resized
#e2fsck -a /dev/VolGroup00/LogVol00 //使用e2fsck指令檢查文件系統錯誤.也可用“fsck -t ext2 -V /dev/sda3/檢查ext2文件系統.
(做fsck,檢查文件系統)
#resize2fs /dev/VolGroup00/LogVol00 //resize2fs指令被用來增大或者收縮未載入的“ext2/ext3”文件系統的大小.
#df -h //查看一下你的系統磁碟空間"/"目錄變成了40GB
ok,這樣就大功告成了.
本文出自 「我成長的地方」 博客,請務必保留此出處http://zhongxw.blog.51cto.com/3429597/787219
[火星人 ] VMware 虛擬機(linux)增加根目錄磁碟空間已經有15498次圍觀