樹心幽徑

« 20190314用php程式加入一筆資料到ms-access2000資料庫檔(selldb.accdb)的goods資料表中 (b2.php) | Main | 20190319在fedora 28裝 hp印表機驅動程式 »

20190318在linux LVM建立多個lv邏輯分割區
2019/03/18,11:16

REF1:https://ithelp.ithome.com.tw/articles/10080861

REF2:https://sc8log.blogspot.com/2017/03/linux-lvm-lvm.html

(0)$ sudo fdisk -l /dev/sda
[sudo] password for treehrt:
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 0CDEAD93-994C-453E-A240-EB952B15039B

所用裝置        Start       結束       磁區   Size 類型
/dev/sda1        2048     534527     532480   260M EFI System
/dev/sda2      534528     567295      32768    16M Microsoft reserved
/dev/sda3      567296  629712895  629145600   300G Microsoft basic data
/dev/sda4   629712896  631810047    2097152     1G Linux filesystem
/dev/sda5  1949788160 1951426559    1638400   800M Windows recovery environment
/dev/sda6   631810048 1949788159 1317978112 628.5G Linux LVM
/dev/sda7  1951426560 1953525134    2098575     1G Linux filesystem

Partition table entries are not in disk order.

(1)$ sudo pvscan
  PV /dev/sda6   VG fedora          lvm2 [<628.46 GiB / <605.69 GiB free]
  Total: 1 [<628.46 GiB] / in use: 1 [<628.46 GiB] / in no VG: 0 [0   ]

(2)$ sudo pvdisplay

  --- Physical volume ---
  PV Name               /dev/sda6
  VG Name               fedora
  PV Size               628.46 GiB / not usable 4.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              160885
  Free PE               155056
  Allocated PE          5829
  PV UUID               TzQpnt-3D8g-z8gf-oYyg-cPre-kxAR-80qnD2

(3)$ sudo lvcreate -L 20476M -n fclv01 fedora
  Logical volume "fclv01" created.

[treehrt@sice ~]$ sudo pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda6
  VG Name               fedora
  PV Size               628.46 GiB / not usable 4.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              160885
  Free PE               149937
  Allocated PE          10948
  PV UUID               TzQpnt-3D8g-z8gf-oYyg-cPre-kxAR-80qnD2

(4)$ sudo lvdisplay
  --- Logical volume ---
  LV Path                /dev/fedora/root
  LV Name                root
  VG Name                fedora
  LV UUID                1oNhCv-IfPQ-tRWq-PLJy-F8v3-IvHK-NZnqXn
  LV Write Access        read/write
  LV Creation host, time localhost, 2019-01-19 10:42:25 +0800
  LV Status              available
  # open                 1
  LV Size                15.00 GiB
  Current LE             3840
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
  
  --- Logical volume ---
  LV Path                /dev/fedora/swap
  LV Name                swap
  VG Name                fedora
  LV UUID                DixTjC-5f3p-ENYr-p3fF-azJA-vTiK-3nFYGe
  LV Write Access        read/write
  LV Creation host, time localhost, 2019-01-19 10:42:26 +0800
  LV Status              available
  # open                 2
  LV Size                <7.77 GiB
  Current LE             1989
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1
  
  --- Logical volume ---
  LV Path                /dev/fedora/fclv01
  LV Name                fclv01
  VG Name                fedora
  LV UUID                Uvjj2Y-lBQ0-V3Mu-42Ui-Mzav-9bns-UU4qR8
  LV Write Access        read/write
  LV Creation host, time sice.kmvs.km.edu.tw, 2019-03-18 11:39:23 +0800
  LV Status              available
  # open                 0
  LV Size                <20.00 GiB
  Current LE             5119
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2
  
(5)$ sudo mkfs.xfs /dev/fedora/fclv01
meta-data=/dev/fedora/fclv01     isize=512    agcount=4, agsize=1310464 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=0, rmapbt=0, reflink=0
data     =                       bsize=4096   blocks=5241856, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

(6)$ mkdir lvmdata

$ pwd
/home/treehrt

(7)$ sudo mount /dev/fedora/fclv01 /home/treehrt/lvmdata

(8)$ df -h
檔案系統                   容量  已用  可用 已用% 掛載點
devtmpfs                   3.9G     0  3.9G    0% /dev
tmpfs                      3.9G   60M  3.8G    2% /dev/shm
tmpfs                      3.9G  1.9M  3.9G    1% /run
tmpfs                      3.9G     0  3.9G    0% /sys/fs/cgroup
/dev/mapper/fedora-root     15G   15G  710M   96% /
tmpfs                      3.9G  316K  3.9G    1% /tmp
/dev/sda4                  976M  126M  783M   14% /boot
/dev/sda1                  256M   33M  224M   13% /boot/efi
tmpfs                      783M   16K  783M    1% /run/user/42
tmpfs                      783M  3.5M  779M    1% /run/user/1000
/dev/mapper/fedora-fclv01   20G   53M   20G    1% /home/treehrt/lvmdata

 

(9)$ sudo vi /etc/fstab
(10)$ cat /etc/fstab
:

/dev/mapper/fedora-root /                       xfs     defaults        0 0
/dev/mapper/fedora-fclv01 /home/treehrt/lvmdata        xfs     defaults        0 0
:

/dev/mapper/fedora-swap swap                    swap    defaults        0 0

 

迴響

 
Accessible and Valid XHTML 1.0 Strict and CSS Powered by LifeType