開機掛載 FS

  1. 建立 vg_mnt-pub 掛載目錄 (此例為 /mnt/pub)。
    [root@kvm10 ~]# mkdir /mnt/pub
    
  2. 編輯 /etc/fstab 設定開機自動掛載 vg_mnt-pub 於 /mnt/pub,vg_mnt-swap 為 swap,建議選擇 /etc/fstab 類似的行,yy 複製,p 貼上,再來修改。
    [root@kvm10 ~]# vi /etc/fstab 
    [root@kvm10 ~]# tail -2 /etc/fstab
    /dev/vg_mnt/pub                           /mnt/pub   vfat   defaults    0 0
    /dev/vg_mnt/swap                          none       swap   defaults    0 0
    
  3. 重新依 /etc/fstab 掛載表掛載檔案系統,因為修改了 /etc/fstab,必須執行 systemctl daemon-reload。
    [root@kvm10 ~]# mount -a
    mount: (hint) your fstab has been modified, but systemd still uses
           the old version; use 'systemctl daemon-reload' to reload.
    [root@kvm10 ~]# systemctl daemon-reload
    
  4. 再重新依 /etc/fstab 掛載表掛載檔案系統,如果沒有錯誤訊息表示正常。
    [root@kvm10 ~]# mount -a
    
  5. 查看 vg_mnt-pub 已成功掛載於 /mnt/pub,且 type 為 vfat。
    [root@kvm10 ~]# df -Th
    Filesystem                Type      Size  Used Avail Use% Mounted on
    /dev/mapper/vg_kvm10-root xfs       4.3G  3.1G  1.2G  73% /
    devtmpfs                  devtmpfs  4.0M     0  4.0M   0% /dev
    tmpfs                     tmpfs     853M     0  853M   0% /dev/shm
    tmpfs                     tmpfs     342M  5.0M  337M   2% /run
    tmpfs                     tmpfs     1.0M     0  1.0M   0% /run/credentials/systemd-journald.service
    /dev/vda2                 xfs       436M  211M  226M  49% /boot
    tmpfs                     tmpfs     1.0M     0  1.0M   0% /run/credentials/getty@tty1.service
    tmpfs                     tmpfs     171M  8.0K  171M   1% /run/user/0
    /dev/mapper/myvdb-vo      ext4      231M   14K  220M   1% /reports
    /dev/mapper/vg_mnt-pub    vfat       24M     0   24M   0% /mnt/pub
    
  6. 檢查 VG vg_mnt 的 PE size 是否如要求 (此例為 2M)。
    [root@kvm10 ~]# vgdisplay vg_mnt
      --- Volume group ---
      VG Name               vg_mnt
      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               <2.61 GiB
      PE Size               2.00 MiB
      Total PE              1334
      Alloc PE / Size       72 / 144.00 MiB
      Free  PE / Size       1262 / 2.46 GiB
      VG UUID               nRn8UJ-TPLK-AOCY-VV5F-tg6N-yx4S-dgigZ1
    
  7. 檢查 LV vg_mnt-pub 的 LE 是否如要求 (此例為 12 個 PE)。
    [root@kvm10 ~]# lvdisplay /dev/vg_mnt/pub 
      --- Logical volume ---
      LV Path                /dev/vg_mnt/pub
      LV Name                pub
      VG Name                vg_mnt
      LV UUID                w6B3rZ-y4E6-UjS9-hlOB-i9h6-Fv8Q-f2DD6F
      LV Write Access        read/write
      LV Creation host, time kvm10.deyu.wang, 2025-12-04 14:36:16 +0800
      LV Status              available
      # open                 1
      LV Size                24.00 MiB
      Current LE             12
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     8192
      Block device           253:3