ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • LVM & RAID
    IoT 과정 2017. 7. 19. 16:59

    Logical Volume 생성하기

    # lvmdiskscan
      /dev/cl/root [      26.99 GiB]
      /dev/sda1    [     953.66 MiB]
      /dev/vda1    [       1.00 GiB]
      /dev/cl/swap [       2.00 GiB]
      /dev/sda2    [       2.07 GiB]
      /dev/vda2    [      29.00 GiB] LVM physical volume  #vm 기본 가상디스크
      /dev/sdb     [       3.00 GiB]
      /dev/sdc     [       3.00 GiB]
      4 disks
      3 partitions
      0 LVM physical volume whole disks
      1 LVM physical volume
    # pvcreate /dev/sdb
      Physical volume "/dev/sdb" successfully created.
    # pvcreate /dev/sdc
      Physical volume "/dev/sdc" successfully created.
    # lvmdiskscan
      /dev/cl/root [      26.99 GiB]
      /dev/sda1    [     953.66 MiB]
      /dev/vda1    [       1.00 GiB]
      /dev/cl/swap [       2.00 GiB]
      /dev/sda2    [       2.07 GiB]
      /dev/vda2    [      29.00 GiB] LVM physical volume
      /dev/sdb     [       3.00 GiB] LVM physical volume
      /dev/sdc     [       3.00 GiB] LVM physical volume
      2 disks
      3 partitions
      2 LVM physical volume whole disks
      1 LVM physical volume
    # vgcreate vgcolor /dev/sdb /dev/sdc
      Volume group "vgcolor" successfully created
    # vgs
      VG      #PV #LV #SN Attr   VSize  VFree
      cl        1   2   0 wz--n- 29.00g 4.00m
      vgcolor   2   0   0 wz--n-  5.99g 5.99g

    # pvs
      PV         VG      Fmt  Attr PSize  PFree
      /dev/sdb   vgcolor lvm2 a--   3.00g 3.00g
      /dev/sdc   vgcolor lvm2 a--   3.00g 3.00g
      /dev/vda2  cl      lvm2 a--  29.00g 4.00m
    # lvcreate -L 2G -n lvred vgcolor
      Logical volume "lvred" created.
    # lvs
      LV    VG      Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
      root  cl      -wi-ao---- 26.99g                                                   
      swap  cl      -wi-ao----  2.00g                                                   
      lvred vgcolor -wi-a-----  2.00g                                                   
    # vgs
      VG      #PV #LV #SN Attr   VSize  VFree
      cl        1   2   0 wz--n- 29.00g 4.00m
      vgcolor   2   1   0 wz--n-  5.99g 3.99g

    # pvdisplay /dev/sdb
      --- Physical volume ---
      PV Name               /dev/sdb
      VG Name               vgcolor
      PV Size               3.00 GiB / not usable 4.00 MiB
      Allocatable           yes
      PE Size               4.00 MiB
      Total PE              767
      Free PE               255
      Allocated PE          512
      PV UUID               4R5def-1n3c-ohnl-Q1C0-JOL5-t0QJ-UKUqC6

    # lvcreate -L 512M -n lvblue vgcolor
      Logical volume "lvblue" created.
    # mkfs.xfs /dev/vgcolor/lvblue
    meta-data=/dev/vgcolor/lvblue    isize=512    agcount=4, agsize=32768 blks
    # mkdir /blue

    # lvcreate -L 512M -n lvgreen vgcolor
      Logical volume "lvgreen" created.
    # mkfs.ext4 /dev/vgcolor/lvgreen
    mke2fs 1.42.9 (28-Dec-2013)
    # mkdir /green
    # vi /etc/fstab
    ... 생략 ...
    /dev/vgcolor/lvgreen /green ext4    defaults    0    1
    /dev/vgcolor/lvblue    /blue    xfs    default        0    1

    # df -hT
    Filesystem                  Type      Size  Used Avail Use% Mounted on
    /dev/mapper/cl-root         xfs        27G  1.1G   26G   5% /
    devtmpfs                    devtmpfs  909M     0  909M   0% /dev
    tmpfs                       tmpfs     920M     0  920M   0% /dev/shm
    tmpfs                       tmpfs     920M  8.5M  912M   1% /run
    tmpfs                       tmpfs     920M     0  920M   0% /sys/fs/cgroup
    /dev/sda1                   xfs       951M   34M  918M   4% /xfs
    /dev/sda2                   ext4      2.0G  258M  1.7G  14% /yohan
    /dev/vda1                   xfs      1014M  141M  874M  14% /boot
    tmpfs                       tmpfs     184M     0  184M   0% /run/user/0
    /dev/mapper/vgcolor-lvblue  xfs       509M   26M  483M   6% /blue
    /dev/mapper/vgcolor-lvgreen ext4      488M  780K  452M   1% /green

    # lvmdiskscan
      /dev/cl/root         [      26.99 GiB]
      /dev/sda1            [     953.66 MiB]
      /dev/vda1            [       1.00 GiB]
      /dev/cl/swap         [       2.00 GiB]
      /dev/sda2            [       2.07 GiB]
      /dev/vda2            [      29.00 GiB] LVM physical volume
      /dev/vgcolor/lvred   [       2.00 GiB]
      /dev/vgcolor/lvblue  [     512.00 MiB]
      /dev/vgcolor/lvgreen [     512.00 MiB]
      /dev/sdb             [       3.00 GiB] LVM physical volume
      /dev/sdc             [       3.00 GiB] LVM physical volume
      5 disks
      3 partitions
      2 LVM physical volume whole disks
      1 LVM physical volume


    Exporting and Importing a VG

    # 볼륨 그룹을 장치에서 떼낼 때 사용한다. OS에서 해당 디바이스를 사용하지 못하게 볼륨그룹을 export한다. 디스크 교체나 상대방에게 디스크를 떼내줄 때 export 까지 수행하면된다. 잘 됐는지 확인하려면 pvscan 명령어를 사용 할 수 있다.

    # df -hT
    Filesystem                  Type      Size  Used Avail Use% Mounted on
    /dev/mapper/cl-root         xfs        27G  1.1G   26G   5% /
    devtmpfs                    devtmpfs  909M     0  909M   0% /dev
    tmpfs                       tmpfs     920M     0  920M   0% /dev/shm
    tmpfs                       tmpfs     920M  8.5M  912M   1% /run
    tmpfs                       tmpfs     920M     0  920M   0% /sys/fs/cgroup
    /dev/sda1                   xfs       951M   38M  914M   4% /xfs
    /dev/vda1                   xfs      1014M  141M  874M  14% /boot
    /dev/sda2                   ext4      2.0G  258M  1.7G  14% /yohan
    /dev/mapper/vgcolor-lvgreen ext4      488M  780K  452M   1% /green
    /dev/mapper/vgcolor-lvblue  xfs       509M   26M  483M   6% /blue
    tmpfs                       tmpfs     184M     0  184M   0% /run/user/0
    # umount /green
    # umount /blue
    # vgchange -an vgcolor
      0 logical volume(s) in volume group "vgcolor" now active

    # vgexport vgcolor
      Volume group "vgcolor" successfully exported
    # pvscan
      PV /dev/vda2   VG cl              lvm2 [29.00 GiB / 4.00 MiB free]
      PV /dev/sdb     is in exported VG vgcolor [3.00 GiB / 508.00 MiB free]
      PV /dev/sdc     is in exported VG vgcolor [3.00 GiB / 2.50 GiB free]
      Total: 3 [34.99 GiB] / in use: 3 [34.99 GiB] / in no VG: 0 [0   ]


    # 다시 OS에서 볼륨 그룹을 인식하고 싶으면 다음과 같이할 수 있다. 하고 난뒤 뗴낸 사람이랑 붙인사람이랑 /etc/fstab 도 정리해야한다.

    # vgimport vgcolor
      Volume group "vgcolor" successfully imported
    # vgchange -ay vgcolor
      3 logical volume(s) in volume group "vgcolor" now active
    # mount -a
    # df -hT
    Filesystem                  Type      Size  Used Avail Use% Mounted on
    /dev/mapper/cl-root         xfs        27G  1.1G   26G   5% /
    devtmpfs                    devtmpfs  909M     0  909M   0% /dev
    tmpfs                       tmpfs     920M     0  920M   0% /dev/shm
    tmpfs                       tmpfs     920M  8.5M  912M   1% /run
    tmpfs                       tmpfs     920M     0  920M   0% /sys/fs/cgroup
    /dev/sda1                   xfs       951M   38M  914M   4% /xfs
    /dev/vda1                   xfs      1014M  141M  874M  14% /boot
    /dev/sda2                   ext4      2.0G  258M  1.7G  14% /yohan
    tmpfs                       tmpfs     184M     0  184M   0% /run/user/0
    /dev/mapper/vgcolor-lvblue  xfs       509M   26M  483M   6% /blue
    /dev/mapper/vgcolor-lvgreen ext4      488M  780K  452M   1% /green


    LVM 구성 보기

    # pvdisplay, vgdisplay, lvdisplay 를 이용하여 볼 수 있다. pvs, vgs, lvs 를 이용하여 포맷을 정해서 출력할 수 있다. 아래는 lvs 사용법이다.

    # lvs -o lv_name,lv_size,devices
      LV      LSize   Devices      
      root     26.99g /dev/vda2(512)
      swap      2.00g /dev/vda2(0) 
      lvblue  512.00m /dev/sdb(512)
      lvgreen 512.00m /dev/sdc(0)  
      lvred     2.00g /dev/sdb(0)
    # lvs -o help
      Logical Volume Fields
      ---------------------
        lv_all                 - All fields in this section.
        lv_uuid                - Unique identifier.
        lv_name                - Name.  LVs created for internal use are enclosed in brackets.
    ... 생략 ...
    # vgdisplay
      --- Volume group ---
      VG Name               cl
      System ID            
      Format                lvm2
      Metadata Areas        1
      Metadata Sequence No  3
      VG Access             read/write
      VG Status             resizable
      MAX LV                0
      Cur LV                2
    ... 생략 ...
      --- Volume group ---
      VG Name               vgcolor
      System ID            
    ... 생략...


    # lvdisplay /dev/vgcolor
      --- Logical volume ---
      LV Path                /dev/vgcolor/lvred
      LV Name                lvred
      VG Name                vgcolor
      LV UUID                87yEQT-2AiY-68dt-8XH7-mX9w-mqE0-JHTcZe
    ....
      --- Logical volume ---
      LV Path                /dev/vgcolor/lvblue
      LV Name                lvblue
      VG Name                vgcolor
      LV UUID                RrB5LH-skdZ-ty5n-c1jc-rTo5-O52q-j07RSF
    .....
      --- Logical volume ---
      LV Path                /dev/vgcolor/lvgreen
      LV Name                lvgreen
      VG Name                vgcolor
      LV UUID                cQvoUp-EfDB-9GEy-RcHC-vZ8G-aaIs-OpztYx
      LV Write Access        read/write
    ....


    새 디스크를 volume group에 추가하고 logical volume에 추가하기. 또 logical volume 용량 줄여보기.

    # 우선 기존상태를 확인해보았다.

    # vgs
      VG      #PV #LV #SN Attr   VSize  VFree
      cl        1   2   0 wz--n- 29.00g 4.00m
      vgcolor   2   3   0 wz--n-  5.99g 2.99g
    # lsscsi
    [2:0:0:1]    disk    QEMU     QEMU HARDDISK    1.5.  /dev/sdc
    [2:0:0:2]    disk    QEMU     QEMU HARDDISK    1.5.  /dev/sdb
    [2:0:0:3]    disk    QEMU     QEMU HARDDISK    1.5.  /dev/sda
    # pvs
      PV         VG      Fmt  Attr PSize  PFree 
      /dev/sdb   vgcolor lvm2 a--   3.00g 508.00m
      /dev/sdc   vgcolor lvm2 a--   3.00g   2.50g
      /dev/vda2  cl      lvm2 a--  29.00g   4.00m


    # 새로 디스크를 추가하고 volume group에 추가한다. volume group이 확장된다. 그뒤 확인해보자.

    # lsscsi
    [2:0:0:1]    disk    QEMU     QEMU HARDDISK    1.5.  /dev/sdc
    [2:0:0:2]    disk    QEMU     QEMU HARDDISK    1.5.  /dev/sdb
    [2:0:0:3]    disk    QEMU     QEMU HARDDISK    1.5.  /dev/sda
    [2:0:0:4]    disk    QEMU     QEMU HARDDISK    1.5.  /dev/sdd
    # vgextend vgcolor /dev/sdd
      Volume group "vgcolor" successfully extended
    # vgs
      VG      #PV #LV #SN Attr   VSize  VFree
      cl        1   2   0 wz--n- 29.00g 4.00m
      vgcolor   3   3   0 wz--n-  8.99g 5.99g
    # pvs
      PV         VG      Fmt  Attr PSize  PFree 
      /dev/sdb   vgcolor lvm2 a--   3.00g 508.00m
      /dev/sdc   vgcolor lvm2 a--   3.00g   2.50g
      /dev/sdd   vgcolor lvm2 a--   3.00g   3.00g
      /dev/vda2  cl      lvm2 a--  29.00g   4.00m


    # 이제 logical volume에 추가해보자.

    # lvextend -L 1G /dev/vgcolor/lvgreen
      Size of logical volume vgcolor/lvgreen changed from 512.00 MiB (128 extents) to 1.00 GiB (256 extents).
      Logical volume vgcolor/lvgreen successfully resized.
    # df -hT |grep "green"
    /dev/mapper/vgcolor-lvgreen ext4      488M  780K  452M   1% /green
    # resize2fs /dev/vgcolor/lvgreen
    resize2fs 1.42.9 (28-Dec-2013)
    Filesystem at /dev/vgcolor/lvgreen is mounted on /green; on-line resizing required
    old_desc_blocks = 1, new_desc_blocks = 1
    The filesystem on /dev/vgcolor/lvgreen is now 262144 blocks long.

    # df -hT |grep "green"
    /dev/mapper/vgcolor-lvgreen ext4      992M  1.3M  935M   1% /green


    # 로지컬 볼륨 green을 다시 리사이징 해보겠다. 디스크 체크를 우선적으로 해야한다.

    # resize2fs /dev/vgcolor/lvgreen 512M
    resize2fs 1.42.9 (28-Dec-2013)
    Please run 'e2fsck -f /dev/vgcolor/lvgreen' first.

    # e2fsck -f /dev/vgcolor/lvgreen
    e2fsck 1.42.9 (28-Dec-2013)
    Pass 1: Checking inodes, blocks, and sizes
    Pass 2: Checking directory structure
    Pass 3: Checking directory connectivity
    Pass 4: Checking reference counts
    Pass 5: Checking group summary information
    /dev/vgcolor/lvgreen: 11/65536 files (0.0% non-contiguous), 8539/262144 blocks

    # resize2fs /dev/vgcolor/lvgreen 512M
    resize2fs 1.42.9 (28-Dec-2013)
    Resizing the filesystem on /dev/vgcolor/lvgreen to 131072 (4k) blocks.
    The filesystem on /dev/vgcolor/lvgreen is now 131072 blocks long.

    # lvs
      LV      VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
      root    cl      -wi-ao----  26.99g                                                   
      swap    cl      -wi-ao----   2.00g                                                   
      lvblue  vgcolor -wi-ao---- 512.00m                                                   
      lvgreen vgcolor -wi-a-----   1.00g                                                   
      lvred   vgcolor -wi-a-----   2.00g                                                   
    # lvreduce -L 512M /dev/vgcolor/lvgreen
      WARNING: Reducing active logical volume to 512.00 MiB.
      THIS MAY DESTROY YOUR DATA (filesystem etc.)
    Do you really want to reduce vgcolor/lvgreen? [y/n]: y
      Size of logical volume vgcolor/lvgreen changed from 1.00 GiB (256 extents) to 512.00 MiB (128 extents).
      Logical volume vgcolor/lvgreen successfully resized.
    # mount /green
    # df -hT | grep "green"
    /dev/mapper/vgcolor-lvgreen ext4      488M  780K  454M   1% /green
    # lvs
      LV      VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
      root    cl      -wi-ao----  26.99g                                                   
      swap    cl      -wi-ao----   2.00g                                                   
      lvblue  vgcolor -wi-ao---- 512.00m                                                   
      lvgreen vgcolor -wi-ao---- 512.00m                                                   
      lvred   vgcolor -wi-a-----   2.00g       


    # 로지컬 볼륨 blue를 확장해보겠다.

    # lvextend -L 1G /dev/vgcolor/lvblue
      Size of logical volume vgcolor/lvblue changed from 512.00 MiB (128 extents) to 1.00 GiB (256 extents).
      Logical volume vgcolor/lvblue successfully resized.
    # xfs_growfs /blue
    meta-data=/dev/mapper/vgcolor-lvblue isize=512    agcount=4, agsize=32768 blks
             =                       sectsz=512   attr=2, projid32bit=1
             =                       crc=1        finobt=0 spinodes=0
    data     =                       bsize=4096   blocks=131072, imaxpct=25
             =                       sunit=0      swidth=0 blks
    naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
    log      =internal               bsize=4096   blocks=855, version=2
             =                       sectsz=512   sunit=0 blks, lazy-count=1
    realtime =none                   extsz=4096   blocks=0, rtextents=0
    data blocks changed from 131072 to 262144
    # df -hT | grep "blue"
    /dev/mapper/vgcolor-lvblue  xfs      1021M   26M  995M   3% /blue


    이론 수업 : page 6-10 ~ 6-12 참고 device work ={ linear, strip (=parallelize), mirror... }

    스냅샷  찍기

    # ls /blue
    # cp /etc/*.conf /blue
    # ls /blue
    asound.conf   GeoIP.conf  libaudit.conf   mke2fs.conf    sudo.conf       yum.conf
    chrony.conf   host.conf   libuser.conf    nsswitch.conf  sudo-ldap.conf
    dnsmasq.conf  kdump.conf  locale.conf     resolv.conf    sysctl.conf
    dracut.conf   krb5.conf   logrotate.conf  rsyslog.conf   tcsd.conf
    e2fsck.conf   ld.so.conf  man_db.conf     sestatus.conf  vconsole.conf

    # lvcreate -s -L 256M -n snap1 /dev/vgcolor/lvblue
      Using default stripesize 64.00 KiB.
      Logical volume "snap1" created.
    # lsblk -f
    NAME                  FSTYPE   LABEL    UUID                                   MOUNTPOINT
    sda                                                                           
    ├─sda1                xfs      XFS_yohan
                                            e4ece575-d12d-4ba2-91f5-50875d1fae68   /xfs
    └─sda2                ext4     FS_ext4  8c876288-69bb-47e6-8dfa-04a33bdd35e9   /yohan
    sdb                   LVM2_mem          4R5def-1n3c-ohnl-Q1C0-JOL5-t0QJ-UKUqC6
    ├─vgcolor-lvred                                                               
    └─vgcolor-lvblue-real                                                         
      ├─vgcolor-lvblue    xfs               1a6e0741-e4a3-4c8a-a067-efc4a8df6dc6   /blue
      └─vgcolor-snap1     xfs               1a6e0741-e4a3-4c8a-a067-efc4a8df6dc6  
    sdc                   LVM2_mem          qtOBMI-T4YC-5k2t-aTPI-UW3M-IUON-RfEzYC
    ├─vgcolor-lvgreen     ext4              d2734656-b417-406a-9a40-2ae5f481c539   /green
    ├─vgcolor-lvblue-real                                                         
    │ ├─vgcolor-lvblue    xfs               1a6e0741-e4a3-4c8a-a067-efc4a8df6dc6   /blue
    │ └─vgcolor-snap1     xfs               1a6e0741-e4a3-4c8a-a067-efc4a8df6dc6  
    └─vgcolor-snap1-cow                                                           
      └─vgcolor-snap1     xfs               1a6e0741-e4a3-4c8a-a067-efc4a8df6dc6  
    sdd                   LVM2_mem          1cmUCb-HQgC-pqux-6U6A-QdoV-HK7f-dw2A4C
    vda                                                                           
    ├─vda1                xfs               372ce9fb-1903-4c73-8316-7cf9a50358fc   /boot
    └─vda2                LVM2_mem          RZ8k6v-wAFn-q1tH-iEng-tZii-OCw3-uim3Z2
      ├─cl-root           xfs               7618555f-1b64-453d-8ce3-42f14d58e395   /
      └─cl-swap           swap              121e58e2-8f0d-40b0-9591-9d7bb5b2e56a   [SWAP]

    # lvs
      LV      VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
      root    cl      -wi-ao----  26.99g                                                   
      swap    cl      -wi-ao----   2.00g                                                   
      lvblue  vgcolor owi-aos---   1.00g                                                   
      lvgreen vgcolor -wi-ao---- 512.00m                                                   
      lvred   vgcolor -wi-a-----   2.00g                                                   
      snap1   vgcolor swi-a-s--- 256.00m      lvblue 0.01                                


    # 이제 백업을 해보자. 로지컬 볼륨 lvblue를 언마운트 하지 않는다면, uuid가 같은 볼륨이 존재하므로 백업이 안된다. no uuid 옵션을 사용할 수 있다.

    # mkdir /backup
    # ll /dev/vgcolor/snap1
    lrwxrwxrwx. 1 root root 7 Jul 20 11:40 /dev/vgcolor/snap1 -> ../dm-7
    # mount /dev/vgcolor/snap1 /backup
    mount: wrong fs type, bad option, bad superblock on /dev/mapper/vgcolor-snap1,
           missing codepage or helper program, or other error

           In some cases useful info is found in syslog - try
           dmesg | tail or so.

    # mount -o nouuid /dev/vgcolor/snap1 /backup
    # ls /backup
    asound.conf   GeoIP.conf  libaudit.conf   mke2fs.conf    sudo.conf       yum.conf
    chrony.conf   host.conf   libuser.conf    nsswitch.conf  sudo-ldap.conf
    dnsmasq.conf  kdump.conf  locale.conf     resolv.conf    sysctl.conf
    dracut.conf   krb5.conf   logrotate.conf  rsyslog.conf   tcsd.conf
    e2fsck.conf   ld.so.conf  man_db.conf     sestatus.conf  vconsole.conf
    # ls /blue
    asound.conf   GeoIP.conf  libaudit.conf   mke2fs.conf    sudo.conf       yum.conf
    chrony.conf   host.conf   libuser.conf    nsswitch.conf  sudo-ldap.conf
    dnsmasq.conf  kdump.conf  locale.conf     resolv.conf    sysctl.conf
    dracut.conf   krb5.conf   logrotate.conf  rsyslog.conf   tcsd.conf
    e2fsck.conf   ld.so.conf  man_db.conf     sestatus.conf  vconsole.conf

    # df -hT
    Filesystem                  Type      Size  Used Avail Use% Mounted on
    /dev/mapper/cl-root         xfs        27G  1.1G   26G   5% /
    devtmpfs                    devtmpfs  909M     0  909M   0% /dev
    tmpfs                       tmpfs     920M     0  920M   0% /dev/shm
    tmpfs                       tmpfs     920M  8.5M  912M   1% /run
    tmpfs                       tmpfs     920M     0  920M   0% /sys/fs/cgroup
    /dev/vda1                   xfs      1014M  138M  877M  14% /boot
    /dev/sda1                   xfs       951M   38M  914M   4% /xfs
    /dev/sda2                   ext4      2.0G  258M  1.7G  14% /yohan
    /dev/mapper/vgcolor-lvblue  xfs      1021M   27M  995M   3% /blue
    tmpfs                       tmpfs     184M     0  184M   0% /run/user/0
    /dev/mapper/vgcolor-lvgreen ext4      488M  780K  454M   1% /green
    /dev/mapper/vgcolor-snap1   xfs      1021M   33M  989M   4% /backup
    # lsblk -f
    NAME                  FSTYPE   LABEL    UUID                                   MOUNTPOINT
    sda                                                                           
    ├─sda1                xfs      XFS_yohan
                                            e4ece575-d12d-4ba2-91f5-50875d1fae68   /xfs
    └─sda2                ext4     FS_ext4  8c876288-69bb-47e6-8dfa-04a33bdd35e9   /yohan
    sdb                   LVM2_mem          4R5def-1n3c-ohnl-Q1C0-JOL5-t0QJ-UKUqC6
    ├─vgcolor-lvred                                                               
    └─vgcolor-lvblue-real                                                         
      ├─vgcolor-lvblue    xfs               1a6e0741-e4a3-4c8a-a067-efc4a8df6dc6   /blue
      └─vgcolor-snap1     xfs               1a6e0741-e4a3-4c8a-a067-efc4a8df6dc6   /backup
    sdc                   LVM2_mem          qtOBMI-T4YC-5k2t-aTPI-UW3M-IUON-RfEzYC
    ├─vgcolor-lvgreen     ext4              d2734656-b417-406a-9a40-2ae5f481c539   /green
    ├─vgcolor-lvblue-real                                                         
    │ ├─vgcolor-lvblue    xfs               1a6e0741-e4a3-4c8a-a067-efc4a8df6dc6   /blue
    │ └─vgcolor-snap1     xfs               1a6e0741-e4a3-4c8a-a067-efc4a8df6dc6   /backup
    └─vgcolor-snap1-cow                                                           
      └─vgcolor-snap1     xfs               1a6e0741-e4a3-4c8a-a067-efc4a8df6dc6   /backup
    sdd                   LVM2_mem          1cmUCb-HQgC-pqux-6U6A-QdoV-HK7f-dw2A4C
    vda                                                                           
    ├─vda1                xfs               372ce9fb-1903-4c73-8316-7cf9a50358fc   /boot
    └─vda2                LVM2_mem          RZ8k6v-wAFn-q1tH-iEng-tZii-OCw3-uim3Z2
      ├─cl-root           xfs               7618555f-1b64-453d-8ce3-42f14d58e395   /
      └─cl-swap           swap              121e58e2-8f0d-40b0-9591-9d7bb5b2e56a   [SWAP]
    # umount /backup


    # 기존 로지컬볼륨의 내용을 삭제하고 lvconvert --merge 로 로지컬 볼륨을 복구한다.


    # rm -rf /blue/*
    # lvs
      LV      VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
      root    cl      -wi-ao----  26.99g                                                   
      swap    cl      -wi-ao----   2.00g                                                   
      lvblue  vgcolor owi-aos---   1.00g                                                   
      lvgreen vgcolor -wi-ao---- 512.00m                                                   
      lvred   vgcolor -wi-a-----   2.00g                                                   
      snap1   vgcolor swi-a-s--- 256.00m      lvblue 0.79  

    # umount /blue
    # lvconvert --merge /dev/vgcolor/snap1
      Merging of volume vgcolor/snap1 started.
      lvblue: Merged: 100.00%
    # mount /blue
    # ls /blue
    asound.conf   GeoIP.conf  libaudit.conf   mke2fs.conf    sudo.conf       yum.conf
    chrony.conf   host.conf   libuser.conf    nsswitch.conf  sudo-ldap.conf
    dnsmasq.conf  kdump.conf  locale.conf     resolv.conf    sysctl.conf
    dracut.conf   krb5.conf   logrotate.conf  rsyslog.conf   tcsd.conf
    e2fsck.conf   ld.so.conf  man_db.conf     sestatus.conf  vconsole.conf

    RAID  자세한 이론내용은 교재 6-19 참고

    # 여러 physical device를 하나의 논리적 device로 바꿔준다. lv 와 비슷한듯.

    Linear RAID
    RAID-0 : stripe
    RAID-1 : mirror (복구가능함, 가용률 50%)
    RAID-1+0 : mirror, stripe (복구와 쓰기 속도 늘림, 가용률 50%)
    RAD-3,4 : stripe, parity (복구를 위한 xor연산, 디스크가 늘수록 디스크 가용률 이 좋음)
    RAID-5 : stripe, distributed parity 복구를 위한 xor연산)
    RAID-6 : stripe, dual parity




    'IoT 과정' 카테고리의 다른 글

    임베디드 관련 블로그  (0) 2017.09.08
    라즈베리파이와 개발pc와의 nfs 설정 및 tftp등등  (0) 2017.09.07
    LVM & RAID  (0) 2017.07.19
    LOCAL STORAGE ADMINISTRATION // 로컬 디스크 관리  (0) 2017.07.19
    SOFTWARE MAINTENANCE  (0) 2017.07.18
    GRUB 관련  (0) 2017.07.18

    댓글 0

Designed by Tistory.