Fedora 11
Sponsored Link

Logical Volume2009/06/11

[1] Create a Logical Volume
# create a Logical Volumes 'ZETA' as 10G space in volume group 'VZ'

[root@ns ~]#
lvcreate -L 10G -n ZETA VZ

  Logical volume "ZETA" created
[2] Display status of Logical Volumes
[root@ns ~]#
lvdisplay

  --- Logical volume ---
  LV Name
/dev/VZ/ZETA

  VG Name
VZ

  LV UUID
H2yACr-cS7P-12lK-miFt-r8ay-FSTF-ETjDEL

  LV Write Access
read/write

  LV Status
available

  # open
0

  LV Size
10.00 GB

  Current LE
2560

  Segments
1

  Allocation
inherit

  Read ahead sectors
0

  Block device
253:35

[3] Change name of Logical Volume
[root@ns ~]#
lvrename VZ ZETA FD3S
 
# change from ZETA to FD3S

[root@ns ~]#
lvdisplay

  --- Logical volume ---
  LV Name
/dev/VZ/FD3S  
# changed

  VG Name
VZ

  LV UUID
H2yACr-cS7P-12lK-miFt-r8ay-FSTF-ETjDEL

  LV Write Access
read/write

  LV Status
available

  # open
0

  LV Size
10.00 GB

  Current LE
2560

  Segments
1

  Allocation
inherit

  Read ahead sectors
0

  Block device
253:35

[4] Output a report of Logical Volumes
[root@ns ~]#
lvs

  LV
VG
Attr
LSize
Origin
Snap%
Move
Copy%

  FD3S
VZ
-wi-a-
10.00G

[5] Scan Logical Volumes
[root@ns ~]#
lvscan

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

[6] Snapshot of a Logical Volume
# create a snapshot of 'FD3S' as named 'SNAP'

[root@ns ~]#
lvcreate -s -L 5G -n SNAP /dev/VZ/FD3S

  Logical volume "SNAP" created
[root@ns ~]#
lvdisplay

  --- Logical volume ---
  LV Name
/dev/VZ/FD3S

  VG Name
VZ

  LV UUID
H2yACr-cS7P-12lK-miFt-r8ay-FSTF-ETjDEL

  LV Write Access
read/write

  LV Status
available

  # open
0

  LV Size
10.00 GB

  Current LE
2560

  Segments
1

  Allocation
inherit

  Read ahead sectors
0

  Block device
253:35


  --- Logical volume ---
  LV Name
/dev/VZ/SNAP

  VG Name
VZ

  LV UUID
GShHon-lVHr-sH0W-S8jr-zYS6-aR3o-9oepmv

  LV Write Access
read/write

  LV snapshot status
active destination for /dev/VZ/FD3S

  LV Status
available

  # open
0

  LV Size
10.00 GB

  Current LE
2560

  COW-table size
5.00 GB

  COW-table LE
1280

  Allocated to snapshot
0.00%

  Snapshot chunk size
8.00 KB

  Segments
1

  Allocation
inherit

  Read ahead sectors
0

  Block device
253:35


[7] Extend a Logical Volume - it's possible to excute with keeping mounted
[root@ns ~]#
lvextend -L 20G /dev/VZ/FD3S
 
# extend to 20G

  Extending logical volume FD3S to 20.00 GB
  Logical volume FD3S successfully resized
[root@ns ~]#
lvdisplay

  --- Logical volume ---
  LV Name
/dev/VZ/FD3S

  VG Name
VZ

  LV UUID
H2yACr-cS7P-12lK-miFt-r8ay-FSTF-ETjDEL

  LV Write Access
read/write

  LV Status
available

  # open
0

  LV Size
20.00 GB
# changed

  Current LE
5120

  Segments
1

  Allocation
inherit

  Read ahead sectors
0

  Block device
253:35


[root@ns ~]#
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@ns ~]#
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@ns ~]#
lvdisplay

  --- Logical volume ---
  LV Name
/dev/VZ/FD3S

  VG Name
VZ

  LV UUID
H2yACr-cS7P-12lK-miFt-r8ay-FSTF-ETjDEL

  LV Write Access
read/write

  LV Status
available

  # open
0

  LV Size
10.00 GB
# changed

  Current LE
2560

  Segments
1

  Allocation
inherit

  Read ahead sectors
0

  Block device
253:35
[9] Remove Logical Volume - unmount file system first.
[root@ns ~]#
lvremove /dev/VZ/FD3S
# remove

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

  Logical volume "FD3S" successfully removed
Matched Content