admin 管理员组

文章数量: 1184232

Virtual Box 增加虚拟内存步骤:
1.安装目录下执行 .\VBoxManage list hdds,显示UUID:           297f254e-ada0-4ddd-be61-552226c3df58
2.安装目录下执行
.\VBoxManage modifyhd 297f254e-ada0-4ddd-be61-552226c3df58 --resize 16384
3.root用户下执行#fdisk /dev/sda
[root@zendlinux ~]# 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): n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4):
First cylinder (1045-2088, default 1045):
Using default value 1045
Last cylinder, +cylinders or +size{K,M,G} (1045-2088, default 2088):
Using default value 2088

Command (m for help): t
Partition number (1-4):
Hex code (type L to list codes): 8e
Changed system type of partition 4 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

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

Disk /dev/sda: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000dc501

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        1045     7875584   8e  Linux LVM
/dev/sda4            1045        2088     8383252   8e  Linux LVM
4.调整 LVM 大小先看看当前 Volume Group:
root@fxq:/dev/ubuntu-vg# vgdisplay
--- Volume group ---
VG Name               ubuntu-vg
System ID
Format                lvm2
Metadata Areas        3
Metadata Sequence No  8
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                1
Open LV               1
Max PV                0
Cur PV                3
Act PV                3
VG Size               <66.35 GiB
PE Size               4.00 MiB
Total PE              16985
Alloc PE / Size       16985 / <66.35 GiB

5.先将分配过来的新磁盘空间创建为一个新的物理卷(查看当前最新的sda编号为准)
#fdisk -l
Device        Start       End  Sectors  Size Type
/dev/sda1      2048      4095     2048    1M BIOS boot
/dev/sda2      4096   4198399  4194304    2G Linux filesystem
/dev/sda3   4198400  62912511 58714112   28G Linux filesystem
/dev/sda4  62912512  83886046 20973535   10G Linux filesystem
/dev/sda5  83886080 143359966 59473887 28.4G Linux filesystem

[root@zendlinux ~]# pvcreate /dev/sda5
dev_is_mpath: failed to get device for 8:4
Physical volume "/dev/sda4" successfully created
6.后使用新的物理卷来扩展 LVM 的ubuntu-vg
[root@zendlinux ~]# vgextend ubuntu-vg /dev/sda5
Volume group "ubuntu-vg" successfully extended
7.然后扩展 LVM 的逻辑卷/dev/ubuntu-vg/ubuntu-lv
#lvextend /dev/ubuntu-vg/ubuntu-lv /dev/sda5

8.调整逻辑卷文件系统的大小
#resize2fs /dev/ubuntu-vg/ubuntu-lv

本文标签: 安装目录 下执行 中玩转大