lvm增加分割槽容量

shawnloong發表於2015-06-14
增加硬碟略
硬碟分割槽
[root@ora10g-1 ~]# fdisk /dev/sda

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): d
Partition number (1-5): 3

Command (m for help): p

Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 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: 0x000391c7

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26        3917    31251456   8e  Linux LVM
/dev/sda4            3917        4177     2094472+  83  Linux

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Selected partition 3
First cylinder (4178-5221, default 4178):
Using default value 4178
Last cylinder, +cylinders or +size{K,M,G} (4178-5221, default 5221):
Using default value 5221

Command (m for help): t
Partition number (1-4): e
Partition number (1-4): 3
Hex code (type L to list codes): 8e
Changed system type of partition 3 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: 裝置或資源忙.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
重啟reboot

[root@ora10g-1 ~]# pvcreate /dev/sda3
  Physical volume "/dev/sda3" successfully created


[root@ora10g-1 ~]# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "vg_ora10g1" using metadata type lvm2
[root@ora10g-1 ~]# df -h
Filesystem                        Size  Used Avail Use% Mounted on
/dev/mapper/vg_ora10g1-LogVol03   7.8G  7.7G     0 100% /
tmpfs                             581M     0  581M   0% /dev/shm
/dev/sda1                         194M   30M  155M  16% /boot
/dev/mapper/vg_ora10g1-LogVolU01  7.8G  2.4G  5.1G  32% /u01
/dev/mapper/vg_ora10g1-LogVol02    12G  9.5G  1.5G  87% /u02
[root@ora10g-1 ~]# vgextend vg_ora10g1 /dev/sda3
  Volume group "vg_ora10g1" successfully extended
[root@ora10g-1 ~]#


[root@ora10g-1 ~]# lvextend -L +7G /dev/vg_ora10g1/LogVol03
  Extending logical volume LogVol03 to 14.83 GiB
  Logical volume LogVol03 successfully resized 

[root@ora10g-1 ~]# resize2fs /dev/mapper/vg_ora10g1-LogVol0
vg_ora10g1-LogVol00  vg_ora10g1-LogVol02  vg_ora10g1-LogVol03 
[root@ora10g-1 ~]# resize2fs /dev/mapper/vg_ora10g1-LogVol03
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/vg_ora10g1-LogVol03 is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/mapper/vg_ora10g1-LogVol03 to 3888128 (4k) blocks.
The filesystem on /dev/mapper/vg_ora10g1-LogVol03 is now 3888128 blocks long.

[root@ora10g-1 ~]# df -h
Filesystem                        Size  Used Avail Use% Mounted on
/dev/mapper/vg_ora10g1-LogVol03    15G  7.7G  6.2G  56% /
tmpfs                             581M     0  581M   0% /dev/shm
/dev/sda1                         194M   30M  155M  16% /boot
/dev/mapper/vg_ora10g1-LogVolU01  7.8G  2.4G  5.1G  32% /u01
/dev/mapper/vg_ora10g1-LogVol02    12G  9.5G  1.5G  87% /u02

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24486203/viewspace-1698708/,如需轉載,請註明出處,否則將追究法律責任。

相關文章