1. 程式人生 > >Ubuntu下建立XFS檔案系統的LVM

Ubuntu下建立XFS檔案系統的LVM

[email protected]:~# 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
#建立PV
[email protected]:~#  pvcreate /dev/sdc1
  Physical volume "/dev/sdc1" successfully created
[email protected]:~# pvscan
  PV /dev/sdc1                      lvm2 [1023.00 GiB]
  Total: 1 [1023.00 GiB] / in use: 0 [0   ] / in no VG: 1 [1023.00 GiB]
#建立VG
[email protected]:~# vgcreate -s 32M VolGroup01 /dev/sdc1
  Volume group "VolGroup01" successfully created
#新增LV
[email protected]:~# 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.
[email protected]:~# lvscan
  ACTIVE            '/dev/VolGroup01/LogVol00' [400.00 GiB] inherit
#格式化
[email protected]:~# 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
#掛載點設定
[email protected]:~# mkdir /mysql_data
[email protected]:~# mount -t xfs /dev/VolGroup01/LogVol00  /mysql_data
[email protected]:~# 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
#建立另外一個LV
[email protected]:~# lvcreate -l 19935 -n LogVol01 VolGroup01
  Logical volume "LogVol01" created.
[email protected]:~# 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
[email protected]:~# mkdir /mysql_backup
[email protected]:~# mount -t xfs /dev/VolGroup01/LogVol01  /mysql_backup/
[email protected]:~# 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