歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Linux 使用LVM擴充硬盤空間

Linux 使用LVM擴充硬盤空間

日期:2017/2/28 16:09:11   编辑:Linux教程

通過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.

Copyright © Linux教程網 All Rights Reserved