欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

linux系統(tǒng)下創(chuàng)建lvm掛載到指定目錄的操作步驟

 更新時(shí)間:2018年02月16日 10:53:32   作者:涼生墨客  
這篇文章主要介紹了linux系統(tǒng)下創(chuàng)建lvm掛載到指定目錄的操作步驟,非常不錯(cuò),具有參考借鑒價(jià)值 ,需要的朋友可以參考下

1 、背景

在企業(yè)中有時(shí)我們?yōu)榉奖惆惭b軟件、數(shù)據(jù)的管理,需要把安裝軟件、數(shù)據(jù)放到固定目錄下,磁盤(pán)滿(mǎn)了方便擴(kuò)展,這里假如需要一個(gè)/data目錄存放數(shù)據(jù),并單獨(dú)進(jìn)行掛載。

2、操作步驟

2.1  劃分磁盤(pán)

2.2 創(chuàng)建PV

[root@centos-6 ~]# pvcreate /dev/sdb1
 Physical volume "/dev/sdb1" successfully created

掃描系統(tǒng)PV可以使用pvscan查看新建的PV

[root@centos-6 ~]# pvscan
 PV /dev/sda2 VG VolGroup lvm2 [19.51 GiB / 0 free]
 PV /dev/sdb1 lvm2 [10.00 GiB]
 Total: 2 [29.51 GiB] / in use: 1 [19.51 GiB] / in no VG: 1 [10.00 GiB]

2.3 創(chuàng)建VG

[root@centos-6 ~]# vgcreate vgtest /dev/sdb1
 Volume group "vgtest" successfully created

注釋?zhuān)簐gtest 為VG的名稱(chēng)

掃描vg

[root@centos-6 ~]# vgscan
 Reading all physical volumes. This may take a while...
 Found volume group "vgtest" using metadata type lvm2
 Found volume group "VolGroup" using metadata type lvm2

查看vg

[root@centos-6 ~]# vgdisplay
 --- Volume group ---
VG Name vgtest
 System ID 
 Format lvm2
 Metadata Areas 1
 Metadata Sequence No 1
 VG Access read/write
 VG Status resizable
 MAX LV 0
 Cur LV 0
 Open LV 0
 Max PV 0
 Cur PV 1
 Act PV 1
 VG Size 10.00 GiB
 PE Size 4.00 MiB
 Total PE 2560
 Alloc PE / Size 0 / 0 
Free PE / Size 2560 / 10.00 GiB
 VG UUID 59Z2ML-CEzB-PivW-zNq9-2kbv-hscJ-drFdR9

 --- Volume group ---
 VG Name VolGroup
 System ID 
 Format lvm2
 Metadata Areas 1
 Metadata Sequence No 3
 VG Access read/write
 VG Status resizable
 MAX LV 0
 Cur LV 2
 Open LV 2
 Max PV 0
 Cur PV 1
 Act PV 1
 VG Size 19.51 GiB
 PE Size 4.00 MiB
 Total PE 4994
 Alloc PE / Size 4994 / 19.51 GiB
 Free PE / Size 0 / 0 
 VG UUID UPJDXo-8RjG-muVj-nVnt-hjXI-aZVv-uGGc2x

2.4 創(chuàng)建LV

[root@centos-6 ~]# lvcreate -l 2560 -n lvdata vgtest 
 Logical volume "lvdata" created.
 

2.5 格式化創(chuàng)建的LV

[root@centos-6 ~]# mkfs -t ext4 /dev/vgtest/lvdata
mke2fs 1.41.12 (17-May-2010)
文件系統(tǒng)標(biāo)簽=
操作系統(tǒng):Linux
塊大小=4096 (log=2)
分塊大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2621440 blocks
131072 blocks (5.00%) reserved for the super user
第一個(gè)數(shù)據(jù)塊=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

正在寫(xiě)入inode表: 完成

Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

2.6 創(chuàng)建目錄并掛載

創(chuàng)建目錄:

[root@centos-6 ~]# mkdir -p /data

掛載目錄

[root@centos-6 ~]# mount /dev/vgtest/lvdata /data

查看

[root@centos-6 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 18G 4.9G 12G 30% /
tmpfs 125M 72K 125M 1% /dev/shm
/dev/sda1 477M 37M 416M 9% /boot
/dev/mapper/vgtest-lvdata 9.8G 23M 9.2G 1% /data

2.7 設(shè)置開(kāi)機(jī)掛載

[root@centos-6 ~]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Sat Feb 3 00:44:14 2018
#
# 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
#
/dev/mapper/VolGroup-lv_root / ext4 defaults 1 1
UUID=49120546-3d8d-4b2e-8559-448613dc072a /boot ext4 defaults 1 2
/dev/mapper/VolGroup-lv_swap swap swap defaults 0 0
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/mapper/vgtest-lvdata /data ext4 defaults 0 0

總結(jié)

以上所述是小編給大家介紹的linux系統(tǒng)下創(chuàng)建lvm掛載到指定目錄的操作步驟,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)歡迎給我留言,小編會(huì)及時(shí)回復(fù)大家的!

相關(guān)文章

最新評(píng)論