加入收藏 | 设为首页 | 会员中心 | 我要投稿 佛山站长网 (https://www.0757zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

新磁盘如何做LVM

发布时间:2016-10-22 06:19:02 所属栏目:Linux 来源:网络整理
导读:一个新的磁盘,如何去做LVM? 一、格式化磁盘 [root@localhost ~]# fdisk -l #查看当前的设备有哪些 Disk /dev/sda: 21.4 GB, 21474836480 bytes 255 heads, 63
副标题[/!--empirenews.page--]

一个新的磁盘,如何去做LVM?

一、格式化磁盘

[root@localhost ~]# fdisk -l   #查看当前的设备有哪些

Disk /dev/sda: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

……此处省略部分输出内容……

/dev/sda3             153        2610    19743885   83  Linux

Disk /dev/sdb: 42.9 GB, 42949672960 bytes

……此处省略部分输出内容……

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

……此处省略部分输出内容……

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

从格式化磁盘开始

[root@localhost ~]# fdisk /dev/sdb  ##对第二块磁盘进行分区

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

此处省………………略若干字

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    ##n表示new,建立新的分区

p   primary partition (1-4)

p    ###代表主分区

Partition number (1-4): 1 ##主分区号

First cylinder (1-5221, default 1): 1##磁盘分区起始点

Last cylinder or +size or +sizeM or +sizeK (1-5221, default 5221): +10000M ##指定第一个分区大小为10G

Command (m for help): n #继续新建分区

Command action

e   extended

p   primary partition (1-4)

p   ##依旧是主分区

Partition number (1-4): 2  ##编号为2

First cylinder (1218-5221, default 1218):

Using default value 1218 ##起始点直接回车表示默认

Last cylinder or +size or +sizeM or +sizeK (1218-5221, default 5221): +20000M  ###指定大小为20G

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

Command action

e   extended

p   primary partition (1-4)

p   ##选择主分区

Partition number (1-4): 3  ##主分区编号为3

First cylinder (3651-5221, default 3651):

Using default value 3651   ###直接回车默认

Last cylinder or +size or +sizeM or +sizeK (3651-5221, default 5221):

Using default value 5221  ####回车默认

Command (m for help): t   ###使用t表示转换分区类型

Partition number (1-4): 1  ###输入分区号

Hex code (type L to list codes): 8e  ###输入分区类型代码

Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): t

Partition number (1-4): 2

Hex code (type L to list codes): 8e

Changed system type of partition 2 to 8e (Linux LVM)

Command (m for help): t

Partition number (1-4): 3

Hex code (type L to list codes): 8e

Changed system type of partition 3 to 8e (Linux LVM)

Command (m for help): p  ###列出所有分区

Disk /dev/sdb: 42.9 GB, 42949672960 bytes

……

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1        1217     9775521   8e  Linux LVM

/dev/sdb2            1218        2434     9775552+  8e  Linux LVM

/dev/sdb3            2435        5221    22386577+  8e  Linux LVM

…………此处省略部分输出内容……

Command (m for help): w   ###保存退出

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@localhost ~]# partprobe  /dev/sdb  /dev/sdc

(编辑:佛山站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读