濮阳杆衣贸易有限公司

主頁(yè) > 知識(shí)庫(kù) > Ubuntu下如何創(chuàng)建XFS文件系統(tǒng)的LVM詳解

Ubuntu下如何創(chuàng)建XFS文件系統(tǒng)的LVM詳解

熱門標(biāo)簽:400電話申請(qǐng)找哪家公司 臨汾電銷機(jī)器人費(fèi)用 昆明外呼系統(tǒng) 河南省鄭州市地圖標(biāo)注 新鄉(xiāng)人工智能電話機(jī)器人加盟 地圖標(biāo)注w是什么方向 福州呼叫中心外呼系統(tǒng)哪家好 地圖標(biāo)注需要提交啥資料入駐 七大洲地圖標(biāo)注

前言

lvm(Logical Volume Manager) 邏輯卷管理, 可以滿足linux系統(tǒng)動(dòng)態(tài)調(diào)整各分區(qū)大小,滿足服務(wù)器在不同的運(yùn)行時(shí)期的需求。

以前在Linux下面玩LVM,一般都是選擇ext3、ext4格式的文件系統(tǒng),最近在Ubuntu 16.04.5下安裝配置一個(gè)MySQL數(shù)據(jù)庫(kù)服務(wù)器,遂測(cè)試了一下XFS文件系統(tǒng)的LVM,其實(shí)仔細(xì)對(duì)比下來(lái),差別不大,只是文件格式化的區(qū)別以及件系統(tǒng)的調(diào)整命令的不同。下面很多地方不做過(guò)多解釋,只是簡(jiǎn)單的記錄測(cè)試過(guò)程。

在測(cè)試服務(wù)器新增一個(gè)磁盤,如下所示,新增的磁盤為/dec/sdc

root@mylnx12:~# fdisk -l
Disk /dev/sdb: 605 GiB, 649613803520 bytes, 1268776960 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2c2c38b3
 
Device  Boot Start  End Sectors Size Id Type
/dev/sdb1  2048 1268774911 1268772864 605G 7 HPFS/NTFS/exFAT
 
 
Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x6e2369f9
 
Device  Boot Start  End Sectors Size Id Type
/dev/sda1 *  2048 62914526 62912479 30G 83 Linux
 
 
Disk /dev/sdc: 1023 GiB, 1098437885952 bytes, 2145386496 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x030b81c8
 
Device  Boot Start  End Sectors Size Id Type
/dev/sdc1  2048 2145386495 2145384448 1023G 83 Linux
 
#創(chuàng)建PV
root@mylnx12:~# pvcreate /dev/sdc1
 Physical volume "/dev/sdc1" successfully created
root@mylnx12:~# pvscan
 PV /dev/sdc1      lvm2 [1023.00 GiB]
 Total: 1 [1023.00 GiB] / in use: 0 [0 ] / in no VG: 1 [1023.00 GiB]
 
#創(chuàng)建VG
root@mylnx12:~# vgcreate -s 32M VolGroup01 /dev/sdc1
 Volume group "VolGroup01" successfully created
 
#新增LV
root@mylnx12:~# lvcreate -L +400G -n LogVol00 VolGroup01
WARNING: xfs signature detected on /dev/VolGroup01/LogVol00 at offset 0. Wipe it? [y/n]: y
 Wiping xfs signature on /dev/VolGroup01/LogVol00.
 Logical volume "LogVol00" created.
root@mylnx12:~# lvscan
 ACTIVE   '/dev/VolGroup01/LogVol00' [400.00 GiB] inherit
 
#格式化
root@mylnx12:~# mkfs.xfs /dev/VolGroup01/LogVol00
meta-data=/dev/VolGroup01/LogVol00 isize=512 agcount=4, agsize=26214400 blks
   =      sectsz=512 attr=2, projid32bit=1
   =      crc=1  finobt=1, sparse=0
data  =      bsize=4096 blocks=104857600, imaxpct=25
   =      sunit=0  swidth=0 blks
naming =version 2    bsize=4096 ascii-ci=0 ftype=1
log  =internal log   bsize=4096 blocks=51200, version=2
   =      sectsz=512 sunit=0 blks, lazy-count=1
realtime =none     extsz=4096 blocks=0, rtextents=0
 
#掛載點(diǎn)設(shè)置
root@mylnx12:~# mkdir /mysql_data
root@mylnx12:~# mount -t xfs /dev/VolGroup01/LogVol00 /mysql_data
root@mylnx12:~# vgdisplay
 --- Volume group ---
 VG Name    VolGroup01
 System ID    
 Format    lvm2
 Metadata Areas  1
 Metadata Sequence No 2
 VG Access    read/write
 VG Status    resizable
 MAX LV    0
 Cur LV    1
 Open LV    0
 Max PV    0
 Cur PV    1
 Act PV    1
 VG Size    1022.97 GiB
 PE Size    32.00 MiB
 Total PE    32735
 Alloc PE / Size  12800 / 400.00 GiB
 Free PE / Size  19935 / 622.97 GiB
 VG UUID    8kutIc-bjId-rNWK-UCHo-TU2l-xkwa-idBXCj
 
#創(chuàng)建另外一個(gè)LV
root@mylnx12:~# lvcreate -l 19935 -n LogVol01 VolGroup01
 Logical volume "LogVol01" created.
root@mylnx12:~# mkfs.xfs /dev/VolGroup01/LogVol01
meta-data=/dev/VolGroup01/LogVol01 isize=512 agcount=4, agsize=40826880 blks
   =      sectsz=512 attr=2, projid32bit=1
   =      crc=1  finobt=1, sparse=0
data  =      bsize=4096 blocks=163307520, imaxpct=25
   =      sunit=0  swidth=0 blks
naming =version 2    bsize=4096 ascii-ci=0 ftype=1
log  =internal log   bsize=4096 blocks=79740, version=2
   =      sectsz=512 sunit=0 blks, lazy-count=1
realtime =none     extsz=4096 blocks=0, rtextents=0
root@mylnx12:~# mkdir /mysql_backup
root@mylnx12:~# mount -t xfs /dev/VolGroup01/LogVol01 /mysql_backup/
root@mylnx12:~# df -h
Filesystem      Size Used Avail Use% Mounted on
udev        6.9G  0 6.9G 0% /dev
tmpfs       1.4G 8.6M 1.4G 1% /run
/dev/sda1       30G 2.1G 27G 8% /
tmpfs       6.9G  0 6.9G 0% /dev/shm
tmpfs       5.0M  0 5.0M 0% /run/lock
tmpfs       6.9G  0 6.9G 0% /sys/fs/cgroup
/dev/sdb1      596G 70M 566G 1% /mnt
tmpfs       1.4G  0 1.4G 0% /run/user/1000
/dev/mapper/VolGroup01-LogVol00 400G 441M 400G 1% /mysql_data
/dev/mapper/VolGroup01-LogVol01 623G 668M 623G 1% /mysql_backup

修改配置文件/etc/fstab,在其增加下面配置信息,如下所示,以便永久保存,確保下次開(kāi)機(jī)啟動(dòng)不丟失相關(guān)掛載點(diǎn)信息。

UUID="a72bd3f8-eb2d-40cb-92c3-d5e32c30d5ff" /mysql_data xfs defaults 0 2
UUID="33325d87-f3f4-4215-abf7-ee795724697e" /mysql_backup xfs defaults 0 2

另外,ext2/ext3/ext4文件系統(tǒng)的調(diào)整命令是resize2fs(增大和減小都支持),而XFS文件系統(tǒng)的調(diào)整命令是xfs_growfs(只支持增大),當(dāng)然硬要減小的話,只能在減小后將邏輯分區(qū)重新通過(guò)mkfs.xfs命令重新格式化才能掛載上,這樣的話這個(gè)邏輯分區(qū)上原來(lái)的數(shù)據(jù)就丟失了。其實(shí)沒(méi)有什么意義。

參考資料:

https://www.jb51.net/article/148553.htm

總結(jié)

以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,如果有疑問(wèn)大家可以留言交流,謝謝大家對(duì)腳本之家的支持。

標(biāo)簽:臨沂 岳陽(yáng) 烏海 紅河 股票 鎮(zhèn)江 四川

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Ubuntu下如何創(chuàng)建XFS文件系統(tǒng)的LVM詳解》,本文關(guān)鍵詞  Ubuntu,下,如何,創(chuàng)建,XFS,文件,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《Ubuntu下如何創(chuàng)建XFS文件系統(tǒng)的LVM詳解》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于Ubuntu下如何創(chuàng)建XFS文件系統(tǒng)的LVM詳解的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    道孚县| 沙坪坝区| 宁明县| 广灵县| 东城区| 木兰县| 丹棱县| 海晏县| 西林县| 山阴县| 泸水县| 文安县| 宿迁市| 马公市| 杭锦后旗| 保山市| 三都| 巨鹿县| 安图县| 腾冲县| 奎屯市| 行唐县| 昌江| 桐柏县| 平远县| 林芝县| 博湖县| 蒲城县| 广水市| 公主岭市| 庄浪县| 门头沟区| 南通市| 平舆县| 柞水县| 宁陵县| 东光县| 岳阳县| 图木舒克市| 榆树市| 全椒县|