参考博客:http://kimjinlsgd.blog.51cto.com/1918030/932210

一、查看磁盘情况

新添加一块磁盘。

[root@VMhost /]# fdisk -l

Disk /dev/sda: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1566 12474472+ 8e Linux LVM

Disk /dev/sdb: 11.2 GB, 11280916480 bytes
255 heads, 63 sectors/track, 1371 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

二、格式化磁盘

[root@VMhost /]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

The number of cylinders for this disk is set to 1371.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n --添加新分区
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1371, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1371, default 1371):
Using default value 1371

Command (m for help): t --指定分区的格式
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/sdb: 11.2 GB, 11280916480 bytes
255 heads, 63 sectors/track, 1371 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 1371 11012526 8e Linux LVM

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

Calling ioctl() to re-read partition table.
Syncing disks.

三、分区挂载

[root@VMhost ~]# lvm

lvm> pvcreate /dev/sdb1
Writing physical volume data to disk "/dev/sdb1"
Physical volume "/dev/sdb1" successfully created
lvm> vgextend VolGroup00 /dev/sdb1
Volume group "VolGroup00" successfully extended

lvm> pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup00
PV Size 11.90 GB / not usable 22.10 MB
Allocatable yes (but full)
PE Size (KByte) 32768
Total PE 380
Free PE 0
Allocated PE 380
PV UUID nwXal0-oUy4-m73q-mvTE-XJ0F-9LI5-BVm2W8

--- Physical volume ---
PV Name /dev/sdb1
VG Name VolGroup00
PV Size 10.50 GB / not usable 2.42 MB
Allocatable yes
PE Size (KByte) 32768
Total PE 336
Free PE 336
Allocated PE 0
PV UUID THT3Vd-Odrb-5J3r-C4Mx-TS3K-EAhe-oRl1rA

[root@VMhost ~]# lvm
lvm> lvdisplay
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID baqpCg-u9O6-KWeW-mOPC-4lME-MLpn-1DUt5D
LV Write Access read/write
LV Status available
# open 1
LV Size 7.94 GB
Current LE 254
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0

--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID JbJcil-wefD-W1xQ-iBXd-FUUc-sL0l-ZGpdKl
LV Write Access read/write
LV Status available
# open 1
LV Size 3.94 GB
Current LE 126
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1

lvm> lvextend -L +10G /dev/VolGroup00/LogVol00
Extending logical volume LogVol00 to 17.94 GB
Logical volume LogVol00 successfully resized
lvm> exit
Exiting.
[root@VMhost ~]# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 4702208 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 4702208 blocks long.

[root@VMhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
18G 3.5G 14G 21% /
/dev/sda1 99M 22M 72M 24% /boot
tmpfs 1007M 0 1007M 0% /dev/shm
[root@VMhost ~]# fdisk -l

Disk /dev/sda: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1566 12474472+ 8e Linux LVM

Disk /dev/sdb: 11.2 GB, 11280916480 bytes
255 heads, 63 sectors/track, 1371 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 1371 11012526 8e Linux LVM

Disk /dev/dm-0: 19.2 GB, 19260243968 bytes
255 heads, 63 sectors/track, 2341 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 4227 MB, 4227858432 bytes
255 heads, 63 sectors/track, 514 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-1 doesn't contain a valid partition table
[root@VMhost ~]# lvm
lvm> lvdisplay
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID baqpCg-u9O6-KWeW-mOPC-4lME-MLpn-1DUt5D
LV Write Access read/write
LV Status available
# open 1
LV Size 17.94 GB
Current LE 574
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0

--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID JbJcil-wefD-W1xQ-iBXd-FUUc-sL0l-ZGpdKl
LV Write Access read/write
LV Status available
# open 1
LV Size 3.94 GB
Current LE 126
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1

OK 挂载成功。

实验环境:VirtualBox-4.2.16-86992-Win

[root@VMhost ~]# uname -a
Linux VMhost.localdomain 2.6.32-300.10.1.el5uek #1 SMP Wed Feb 22 17:22:40 EST 2012 i686 i686 i386 GNU/Linux

ORACLE linux 5.8

虚拟机添加磁盘LVM分区的更多相关文章

  1. exsi中的虚拟机添加磁盘后虚拟机中磁盘不出现

    exsi中的虚拟机添加磁盘后虚拟机中磁盘不出现解决: 计算机---> 管理: 这里可以选择磁盘,格式,分区, 改盘符等操作

  2. linux添加磁盘及分区挂载

    磁盘管理 1.为什么要添加磁盘 随着系统的使用,磁盘的内容会越来越少,所以这时要添加磁盘增加空间 Linux系统中磁盘管理就是将硬盘通过挂载的方式挂载到linux文件系统中. 2.系统添加磁盘并分区 ...

  3. 如何给VirtualBox虚拟机的ubuntu LVM分区扩容

    我在VirtualBox安装的ubuntu里安装Cloud Foundry时遇到错误信息,磁盘空间不够了: 使用这三个命令做了清理之后,结果依然不够理想: (1) sudo apt-get autoc ...

  4. Centos7添加磁盘并分区格式化

    1.安装前准备 [root@localhost ~]# yum install xfsprogs [root@localhost ~]# modprobe xfs [root@localhost ~] ...

  5. vSphere SDK for Java - 为虚拟机添加磁盘

    示例代码: import com.vmware.vim25.*; import com.vmware.vim25.mo.*; import org.springframework.stereotype ...

  6. ViutualBox虚拟机里添加磁盘

    1.首先在VirtualBox界面给虚拟机添加一块磁盘 2. 启动系统,查看当前磁盘空间 Last login: Tue Mar 15 22:24:47 2016 from 192.168.1.100 ...

  7. 在线添加磁盘,扩展LVM卷案例

    一.添加硬盘,在线扫描出来 首先到虚拟机那里添加一块硬盘,注意必须是SCSI类型的硬盘. 扫描硬盘,不用重启操作系统的. echo "- - -" > /sys/class/ ...

  8. VMware虚拟机下为Ubuntu添加磁盘

    20G的磁盘还是不够用啊,正好复习下磁盘分区和逻辑卷. 关闭虚拟机,打开VMware,右键虚拟机点击设置,点下下方的添加,就可以添加磁盘了. 进入虚拟机,查看: root@ubuntu:/# fdis ...

  9. 管理员技术(六): 硬盘分区及格式化、 新建一个逻辑卷、调整现有磁盘的分区、扩展逻辑卷的大小、添加一个swap分区

    一.硬盘分区及格式化 问题: 本例要求熟悉硬盘分区结构,使用fdisk分区工具在磁盘 /dev/vdb 上按以下要求建立分区: 1> 采用默认的 msdos 分区模式        2> ...

随机推荐

  1. Linux添加环境变量与GCC编译器添加INCLUDE与LIB环境变量

    对所有用户有效在/etc/profile增加以下内容.只对当前用户有效在Home目录下的.bashrc或.bash_profile里增加下面的内容:(注意:等号前面不要加空格,否则可能出现 comma ...

  2. Android_Toast

    xml文件: main1: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" ...

  3. Objec类和final关键字的用法

    一.在继承中,子类继承父类,那父类继承谁呢,java中如果类没有指定继承谁,那么就默认继承Object类,object类是所有对象的直接或者间接的父类,根类,或者叫做基类,它里面定义的功能所有的对象都 ...

  4. [转载]传智播客_SQL入门

    原文地址:传智播客_SQL入门作者:happylonger SQL * 数据定义语言 DDL * 数据操作语言 DML * 查询和更新指令构成了 SQL 的 DML 部分:  * SELECT - 从 ...

  5. nginx配置文件特殊字符说明

    开发过程中经常重复配置nginx.conf,对里面的特殊字符始终不太明白具体的意义,今天百度nginx配置看到一篇不错的文章,转载记录下来,以备不时之需. nginx rewrite 正则表达式匹配 ...

  6. Linux Shell产生16进制随机数

    n为字符长度 openssl rand -hex n

  7. 关于Apache Commons-Lang的总结

    部分转载至:http://linhongyu.blog.51cto.com/6373370/1553329 一.前言 Java码农不识Apache,敲尽一生也枉然.旗下的开源项目众多,各个都是吊炸天. ...

  8. 解决codeforces访问慢的问题

    转载至:http://blog.csdn.net/wmx16835/article/details/38639451 前阵子打Codeforces(以下简称CF),每次比赛的时候都要等待网页刷新.不是 ...

  9. Sharepoint 移动客户端 Rshare的特点

    1.随时随地快速访问SharePoint,和同事高效合作,实时浏览日历信息,完整日程安排.查看联系人信息.浏览公告,文档和图片等. 添加图片到相册,通过Email和他人分享. 2.新建.上传:新建日历 ...

  10. ClassLoader和Reflect

    什么情况下使用ClassLoader来加载类?其实这个问题应该问,什么时候使用import来加载类,不能使用import的,就只能使用ClassLoader了. 使用import的条件: 1.必须是存 ...