Fedora 15
Sponsored Link

Logical Volume
2011/05/09
[1] Create a Logical Volume
# create a Logical Volumes 'lv_data' as 50G in volume group 'vg_data'

[root@dlp ~]#
lvcreate -L 50G -n lv_data vg_data

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

  --- Logical volume ---
  LV Name
/dev/vg_data/lv_data

  VG Name
vg_data

  LV UUID
Am3T89-eeB2-0dOd-ic1H-HDsG-bFJL-DFENt9

  LV Write Access
read/write

  LV Status
available

  # open
0

  LV Size
50.00 GB

  Current LE
12800

  Segments
1

  Allocation
inherit

  Read ahead sectors
auto

  - currently set to
256

  Block device
253:3

[3] Rename a Logical Volume
[root@dlp ~]#
lvrename vg_data lv_data lv_storage
 
# rename from "lv_data" to "lv_storage"

  Renamed "lv_data" to "lv_storage" in volume group "vg_data"
[root@dlp ~]#
lvdisplay

  --- Logical volume ---
  LV Name
/dev/vg_data/lv_storage  
# changed

  VG Name
vg_data

  LV UUID
Am3T89-eeB2-0dOd-ic1H-HDsG-bFJL-DFENt9

  LV Write Access
read/write

  LV Status
available

  # open
0

  LV Size
50.00 GB

  Current LE
12800

  Segments
1

  Allocation
inherit

  Read ahead sectors
auto

  - currently set to
256

  Block device
253:3

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

  LV
VG
Attr
LSize
Origin
Snap%
  Move
  Copy%   Convert

  lv_storage
vg_data
-wi-a-
50.00G

  lv_home
vg_dlp
-wi-ao
30.63g

  lv_root
vg_dlp
-wi-ao
20.00g

  lv_swap
vg_dlp
-wi-ao
5.88g

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

  ACTIVE
'/dev/vg_data/lv_storage' [50.00 GiB] inherit

  ACTIVE
'/dev/vg_dlp/lv_home' [30.63 GiB] inherit

  ACTIVE
'/dev/vg_dlp/lv_root' [20.00 GiB] inherit

  ACTIVE
'/dev/vg_dlp/lv_swap' [5.88 GiB] inherit

[6] Snapshot of a Logical Volume
# create a Snapshot named 'snap-lv_storage' from 'lv_storage'

[root@dlp ~]#
lvcreate -s -L 50G -n snap-lv_storage /dev/vg_data/lv_storage

  Logical volume "snap-lv_storage" created
[root@dlp ~]#
lvdisplay

  --- Logical volume ---
  LV Name
/dev/vg_data/lv_storage

  VG Name
vg_data

  LV UUID
Am3T89-eeB2-0dOd-ic1H-HDsG-bFJL-DFENt9

  LV Write Access
read/write

  LV Status
available

  # open
0

  LV Size
50.00 GB

  Current LE
12800

  Segments
1

  Allocation
inherit

  Read ahead sectors
auto

  - currently set to
256

  Block device
253:3


  --- Logical volume ---
  LV Name
/dev/vg_data/snap-lv_storage

  VG Name
vg_data

  LV UUID
Dy0PCV-izK5-vbC5-qoxP-3w1k-GGvw-atL2lU

  LV Write Access
read/write

  LV snapshot status
active destination for /dev/vg_data/lv_storage

  LV Status
available

  # open
0

  LV Size
50.00 GB

  Current LE
12800

  Segments
1

  Allocation
inherit

  Read ahead sectors
auto

  - currently set to
256

  Block device
253:3

[7] Extend a Logical Volume - it's possible to excute with keeping mounted
[root@dlp ~]#
lvextend -L 100G /dev/vg_data/lv_storage
 
# Extend to 100G

  Extending logical volume lv_storage to 100.00 GiB
  Logical volume lv_storage successfully resized
[root@dlp ~]#
lvdisplay

  --- Logical volume ---
  LV Name
/dev/vg_data/lv_storage

  VG Name
vg_data

  LV UUID
Am3T89-eeB2-0dOd-ic1H-HDsG-bFJL-DFENt9

  LV Write Access
read/write

  LV Status
available

  \# open
0

  LV Size
100.00 GiB  
# changed

  Current LE
25600

  Segments
1

  Allocation
inherit

  Read ahead sectors
auto

  - currently set to
256

  Block device
253:3


[root@dlp ~]#
resize2fs /dev/vg_data/lv_storage

resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/VZ/FD3S is mounted on /; on-line resizing required
Resizing the filesystem on /dev/vg_data/lv_storage to 39321600 (4k) blocks.
The filesystem on /dev/vg_data/lv_storage is now 39321600 blocks long.
[8] Reduce a Logical Volume - This destroys a file system, so Take Back-up first.
[root@dlp ~]#
lvreduce -L 50G /dev/vg_data/lv_storage
 
# Reduce to 50G

  WARNING: Reducing active logical volume to 50.00 GiB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv_storage? [y/n]:
y

  Reducing logical volume lv_storage to 50.00 GiB
  Logical volume lv_storage successfully resized
[root@dlp ~]#
lvdisplay

  --- Logical volume ---
  LV Name
/dev/vg_data/lv_storage

  VG Name
vg_data

  LV UUID
Am3T89-eeB2-0dOd-ic1H-HDsG-bFJL-DFENt9

  LV Write Access
read/write

  LV Status
available

  \# open
0

  LV Size
50.00 GB  
# changed

  Current LE
12800

  Segments
1

  Allocation
inherit

  Read ahead sectors
auto

  - currently set to
256

  Block device
253:3
[9] Remove Logical Volume - unmount a file system first.
[root@dlp ~]#
lvremove /dev/vg_data/lv_storage

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

  Logical volume "lv_storage" successfully removed
Matched Content
 
Tweet