Oracle VM扩容磁盘空间

  在Oracle VM时,意外发现空间小了,不想重装,只好扩容了。 还好Oracle VM算比较好用,就扩容一下。
步骤如下:
1. 查出要增加容量的映像的uuid
C:\Users\XCL>cd C:\Program Files\Oracle\VirtualBox
C:\Program Files\Oracle\VirtualBox>vboxmanage list hdds
UUID: dc54c773-8c62-43fe-92e2-e3e0d7ee8d5e
Parent UUID: base
Format: VDI
Location: D:\OracleVM\11RAC1\11RAC1.vdi
State: created
Type: normal
Usage: 11RAC1 (UUID: 2499fdd3-5595-4260-b1c0-12472a44b53f)
2.给查出的UUID扩容。
 扩容:
5242880 == 5TB
 30720 = 30 GB
VBoxManage modifyhd dc54c773-8c62-43fe-92e2-e3e0d7ee8d5e –resize 5242880
也可以:
VBoxManage modifyhd D:\OracleVM\11RAC1\11RAC1.vdi –resize 5242880
3.进linux,这时df是没找不到扩出来的空间的,用fdisk才可以看到。
  然后fdisk 一下查出来的 /dev/sda。
a. 查看下现有的
[root@rac1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_xclrac1-lv_root
                       16G 12G 3.4G 77% /
tmpfs 1004M 260K 1004M 1% /dev/shm
/dev/sda1 485M 56M 404M 13% /boot
b.打印下当前分区情况
[root@rac1 ~]# fdisk -l
Disk /dev/sda: 5497.6 GB, 5497558138880 bytes
255 heads, 63 sectors/track, 668373 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: 0x000eb935
c.新建主分区并保存
[root@rac1 dev]# fdisk /dev/sda
WARNING: The size of this disk is 5.5 TB (5497558138880 bytes).
DOS partition table format can not be used on drives for volumes
larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID
partition table format (GPT).
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): 3
First cylinder (2611-668373, default 2611):
Using default value 2611
Last cylinder, +cylinders or +size{K,M,G} (2611-267349, default 267349):
Using default value 267349
Command (m for help): 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.
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)
Syncing disks.
c.重启。
  shutdown -ry 0
4.  在/dev下,可以看到新n出来的/dev/sda3
[root@rac1 ~]# ls /dev/sd*
/dev/sda /dev/sda2 /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf
/dev/sda1 /dev/sda3 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1
5.现在可以格式化了,首先要查出现在的系统文件格式,为分区作准备. 这里
    a. df -Th
    b. 将分区类型改成 Linux
       fdisk /dev/sda -> T -> 选之前的3 -> L -> 选 83(Linux) -> w 保存即可
    c. 再检查下
[root@rac1 dev]# fdisk -l
Disk /dev/sda: 5497.6 GB, 5497558138880 bytes
255 heads, 63 sectors/track, 668373 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: 0x000eb935
   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 2611 20458496 8e Linux LVM
/dev/sda3 2611 267349 2126509322+ 83 Linux
d.格式化成ext4
mkfs -t ext4 -c /dev/sda3
6. 挂载即可
    mount /dev/sda3 /u01
    df -Th
7. 让它以后在系统重启时,自动挂载.
  vi /etc/fstab
  #xcl
  /dev/sda3 /u01 ext4 defaults 0 0
MAIL:xcl_168@aliyun.com
Blog:http://blog.csdn.net/xcl168

标签