Linux 使用LVM扩充硬盘空间


通过df -h 命令可以查看系统现有的磁盘空间的使用情况。

现有的磁盘空间的使用情况

如果我们有为使用的磁盘空间我们可以通过 fdisk -l 命令查看

 

查看未使用的磁盘空间

 

在这里我们可以查看到有 /dev/xvdc  磁盘没有分配, 大小是43G 的空间。

我们现在启用这个磁盘空间, 首先格式化

输入命令  fdisk /dev/xvdc

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 2871.
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 0×0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n   #输入n,新建分区

Command action
   e   extended
   p   primary partition (1-4)
   p  #输入P,主分区


Partition number (1-4): 1   #目前是xvdc第一个分区输入1

First cylinder (1-2871, default 1):  #敲回车,默认就行了
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2871, default 2871):
Using default value 2871

Command (m for help): t   #这里输入t,指定分区的格式为8e (LVM)
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): w  #这里输入w,保存退出
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

磁盘分区 

  • 1
  • 2
  • 下一页

相关内容