温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Linux下如何添加磁盘创建LVM

发布时间:2021-11-08 11:47:51 来源:亿速云 阅读:202 作者:小新 栏目:建站服务器

这篇文章给大家分享的是有关Linux下如何添加磁盘创建LVM的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

shell> fdisk /dev/xvdb    #### 选择磁盘
Command (m for help): m    #### 帮助
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)
Command (m for help): n    #### 创建新的分区
Command action
   e   extended
   p   primary partition (1-4)
p    #### 创建主分区
Partition number (1-4):1     #### 分区ID
First cylinder (1-65270, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-65270, default 65270): 
Using default value 65270


Command (m for help):t   #### 修改分区类型
Command (m for help):8e    #### Linux lvm
Command (m for help):w      #### 保存修改
shell> pvcreate /dev/xvdb1/    #### 创建新的pv卷
shell> pvs    #### 查看pv卷
shell> vgcreate VolGroup01 /dev/xvdb1/   #### 创建新的vg卷
shell> vgs   #### 查看vg卷
shell> lvcreate -L 50G -n lvmServer    VolGroup01     #### 创建逻辑卷 -L 指定分区大小 -n 指定lvm名称
shell> mkfs.ext4 /dev/VolGroup01/lvmServer           #### 使用mkfs.ext4命令在逻辑卷lvmServer上创建ext4文件系统
shell> mount /dev/VolGroup01/lvmServer /server/      #### 挂在分区到本地目录/server
shell> vi /etc/fstab     #### 修改fstab 开机自动挂载
#
# /etc/fstab
# Created by anaconda on Thu Aug 14 21:16:42 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=94e4e384-0ace-437f-bc96-057dd64f42ee / ext4 defaults,barrier=0 1 1
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/VolGroup01/lvmServer       /server         ext4    defaults        0 0
:wq
#### 保存重启测试 
注意:
* fstab一定要正确填写路径,一旦出错,可能无法正常启动.
* 可以在rc.local使用mount命令进行挂载

感谢各位的阅读!关于“Linux下如何添加磁盘创建LVM”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI