行业新闻

通过媒体报道,了解更多IDC行业资讯

>行业动态  > 

LVM磁盘管理实录

[root@kvm01 ~]# fdisk -l
Disk /dev/sda: 122.9 GB, 122941242880 bytes
255 heads, 63 sectors/track, 14946 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0001e60a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64       14947   119545856   8e  Linux LVM

Disk /dev/mapper/vg_kvm03-lv_root: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg_kvm03-lv_swap: 6316 MB, 6316621824 bytes
255 heads, 63 sectors/track, 767 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg_kvm03-lv_home: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

[root@kvm01 ~]# lvreduce -L -20G /dev/mapper/vg_kvm03-lv_home
  Unable to reduce lv_home below 1 extent
  Run `lvreduce --help' for more information.
[root@kvm01 ~]# lvreduce -L -10G /dev/mapper/vg_kvm03-lv_home
  WARNING: Reducing active logical volume to 10.00 GiB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv_home? [y/n]: y
  Reducing logical volume lv_home to 10.00 GiB
  Logical volume lv_home successfully resized

[root@kvm01 ~]# vgdisplay 
  --- Volume group ---
  VG Name               vg_kvm03
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  7
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               114.00 GiB
  PE Size               4.00 MiB
  Total PE              29185
  Alloc PE / Size       24546 / 95.88 GiB
  Free  PE / Size       4639 / 18.12 GiB
  VG UUID               VOXTxP-311D-4Ogf-VW3U-ngrL-mQjf-NzkyfH

[root@kvm01 ~]# lvextend -L +18G /dev/mapper/vg_kvm03-lv_root
  Extending logical volume lv_root to 98.00 GiB
  Logical volume lv_root successfully resized
[root@kvm01 ~]# vgdisplay 
  --- Volume group ---
  VG Name               vg_kvm03
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  8
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               114.00 GiB
  PE Size               4.00 MiB
  Total PE              29185
  Alloc PE / Size       29154 / 113.88 GiB
  Free  PE / Size       31 / 124.00 MiB
  VG UUID               VOXTxP-311D-4Ogf-VW3U-ngrL-mQjf-NzkyfH

[root@kvm01 ~]# e2fsck -f  /dev/mapper/vg_kvm03-lv_root
e2fsck 1.41.12 (17-May-2010)
/dev/mapper/vg_kvm03-lv_root is mounted.
e2fsck: Cannot continue, aborting.

[root@kvm01 ~]# resize2fs /dev/mapper/vg_kvm03-lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/vg_kvm03-lv_root is mounted on /; on-line resizing required
old desc_blocks = 5, new_desc_blocks = 7
Performing an on-line resize of /dev/mapper/vg_kvm03-lv_root to 25690112 (4k) blocks.
The filesystem on /dev/mapper/vg_kvm03-lv_root is now 25690112 blocks long.

[root@kvm01 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_kvm03-lv_root
                       97G   46G   46G  51% /
tmpfs                 5.9G     0  5.9G   0% /dev/shm
/dev/sda1             485M  148M  312M  33% /boot

  • 售后企业QQ:931283281 售后企业QQ:931283281 售后企业QQ:931283281
  • 公司值班电话:0731-82291009
老邓 乐乐 HC 稻香 小瓜 24小时售后
恒方科技
通讯地址:湖南省长沙市雨花区人民东路162号左岸右岸A栋1602室
邮政编码:410007
24H客服电话:0731-82291009
24小时网维支持 投诉与建议
收缩

欢迎加好友咨询

  • 老邓(QQ) 97156535
  • 乐乐(QQ) 97156534
  • HC(QQ) 1516766058
  • 售后(QQ) 931283281
  • 电话:0731-82291009
  • 手机/微信:18900790677