티스토리 뷰

EN/Debian 6

Debian 6 LVM Logical Volumes

ServerWorld 2016.05.23 22:19

Debian 6 LVM Logical Volumes


Logical Volumes


1. Create a Logical Volume

# create a Logical Volumes 'ZETA' as 10G space in volume group 'VZ'

root@debian:~# lvcreate -L 10G -n ZETA VZ

  Logical volume "ZETA" created

  

  

  

2. Display status of Logical Volumes

root@debian:~# lvdisplay

  --- Logical volume ---

  LV Name/dev/VZ/ZETA

  VG NameVZ

  LV UUIDH2yACr-cS7P-12lK-miFt-r8ay-FSTF-ETjDEL

  LV Write Accessread/write

  LV Statusavailable

  # open0

  LV Size10.00 GB

  Current LE2560

  Segments1

  Allocationinherit

  Read ahead sectors0

  Block device253:35

  

  

  

3. Change name of Logical Volume


root@debian:~# lvrename VZ ZETA FD3S   # change from ZETA to FD3S

root@debian:~# lvdisplay

  --- Logical volume ---

  LV Name/dev/VZ/FD3S   # changed

  VG NameVZ

  LV UUIDH2yACr-cS7P-12lK-miFt-r8ay-FSTF-ETjDEL

  LV Write Accessread/write

  LV Statusavailable

  # open0

  LV Size10.00 GB

  Current LE2560

  Segments1

  Allocationinherit

  Read ahead sectors0

  Block device253:35

  

  

  

4. Output a report of Logical Volumes


root@debian:~# lvs

  LV VGAttrLSizeOriginSnap%MoveCopy%

  FD3SVZ-wi-a-10.00G

  

  

  

5. Scan Logical Volumes


root@debian:~# lvscan

  ACTIVE '/dev/VZ/FD3S' [10.00 GB] inherit

  

  

  

6. Snapshot of a Logical Volume


# create a snapshot of 'FD3S' as named 'SNAP'

root@debian:~# lvcreate -s -L 5G -n SNAP /dev/VZ/FD3S

  Logical volume "SNAP" created

root@debian:~# lvdisplay

  --- Logical volume ---

  LV Name/dev/VZ/FD3S

  VG NameVZ

  LV UUIDH2yACr-cS7P-12lK-miFt-r8ay-FSTF-ETjDEL

  LV Write Accessread/write

  LV Statusavailable

  # open0

  LV Size10.00 GB

  Current LE2560

  Segments1

  Allocationinherit

  Read ahead sectors0

  Block device253:35


  --- Logical volume ---

  LV Name/dev/VZ/SNAP

  VG NameVZ

  LV UUIDGShHon-lVHr-sH0W-S8jr-zYS6-aR3o-9oepmv

  LV Write Accessread/write

  LV snapshot statusactive destination for /dev/VZ/FD3S

  LV Statusavailable

  # open0

  LV Size10.00 GB

  Current LE2560

  COW-table size5.00 GB

  COW-table LE1280

  Allocated to snapshot0.00%

  Snapshot chunk size8.00 KB

  Segments1

  Allocationinherit

  Read ahead sectors0

  Block device253:35


  

  

7. Extend a Logical Volume - it's possible to excute with keeping mounted


root@debian:~# lvextend -L 20G /dev/VZ/FD3S   # extend to 20G

  Extending logical volume FD3S to 20.00 GB

  Logical volume FD3S successfully resized

root@debian:~# lvdisplay

  --- Logical volume ---

  LV Name/dev/VZ/FD3S

  VG NameVZ

  LV UUIDH2yACr-cS7P-12lK-miFt-r8ay-FSTF-ETjDEL

  LV Write Accessread/write

  LV Statusavailable

  # open0

  LV Size20.00 GB# changed

  Current LE5120

  Segments1

  Allocationinherit

  Read ahead sectors0

  Block device253:35


root@debian:~# resize2fs /dev/VZ/FD3S# resize

resize2fs 1.39 (29-May-2006)

Filesystem at /dev/VZ/FD3S is mounted on /; on-line resizing required

Performing an on-line resize of /dev/VZ/FD3S to 5242880 (4k) blocks.

The filesystem on /dev/VZ/FD3S is now 5242880 blocks long.




8. Reduce a Logical Volume - This destroys file system, so Backup first.


root@debian:~# lvreduce -L 10G /dev/VZ/FD3S   # reduce to 10G

  WARNING: Reducing active logical volume to 10.00 GB

  THIS MAY DESTROY YOUR DATA (filesystem etc.)

Do you really want to reduce FD3S? [y/n]: y   # Yes

  Reducing logical volume FD3S to 10.00 GB

  Logical volume FD3S successfully resized

root@debian:~# lvdisplay

  --- Logical volume ---

  LV Name/dev/VZ/FD3S

  VG NameVZ

  LV UUIDH2yACr-cS7P-12lK-miFt-r8ay-FSTF-ETjDEL

  LV Write Accessread/write

  LV Statusavailable

  # open0

  LV Size10.00 GB# changed

  Current LE2560

  Segments1

  Allocationinherit

  Read ahead sectors0

  Block device253:35


  

  

9. Remove Logical Volume - unmount file system first.


root@debian:~# lvremove /dev/VZ/FD3S# remove

Do you really want to remove active logical volume "FD3S"? [y/n]: y

  Logical volume "FD3S" successfully removed


※ Next manual



저작자 표시 비영리 변경 금지
신고

'EN > Debian 6' 카테고리의 다른 글

Debian 6 Clamav - Anti-Virus  (0) 2016.05.23
Debian 6 LVM Logical Volumes  (0) 2016.05.23
Debian 6 LVM Volume Groups  (0) 2016.05.23
Debian 6 LVM Physical Volumes  (0) 2016.05.23
Debian 6 Create SSL Certificates  (0) 2016.05.23
Debian 6 Desktop Env VNC Server  (0) 2016.05.23
댓글