redhat拓展分区

Last login: Tue Apr 21 02:15:34 2015 from 192.168.249.2
[root@localhost ~]# df -Th
Filesystem                   Type   Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root ext4    18G  8.7G  7.7G  53% /
tmpfs                        tmpfs  4.0G   72K  4.0G   1% /dev/shm
/dev/vda1                    ext4   485M   39M  421M   9% /boot
[root@localhost ~]# fdisk -l


Disk /dev/vda: 214.7 GB, 214748364800 bytes
16 heads, 63 sectors/track, 416101 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b40a3


   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *           3        1018      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/vda2            1018       41611    20458496   8e  Linux LVM
Partition 2 does not end on cylinder boundary.


Disk /dev/mapper/VolGroup-lv_root: 18.8 GB, 18798870528 bytes
255 heads, 63 sectors/track, 2285 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/VolGroup-lv_swap: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 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@localhost ~]# clear
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# df -h
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root   18G  8.7G  7.7G  54% /
tmpfs                         4.0G   72K  4.0G   1% /dev/shm
/dev/vda1                     485M   39M  421M   9% /boot
[root@localhost ~]# 
[root@localhost ~]# fdisk -cul


Disk /dev/vda: 214.7 GB, 214748364800 bytes
16 heads, 63 sectors/track, 416101 cylinders, total 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b40a3


   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048     1026047      512000   83  Linux
/dev/vda2         1026048    41943039    20458496   8e  Linux LVM


Disk /dev/mapper/VolGroup-lv_root: 18.8 GB, 18798870528 bytes
255 heads, 63 sectors/track, 2285 cylinders, total 36716544 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000




Disk /dev/mapper/VolGroup-lv_swap: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders, total 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


[root@localhost ~]# 
[root@localhost ~]# fdisk /dev/vda


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): p


Disk /dev/vda: 214.7 GB, 214748364800 bytes
16 heads, 63 sectors/track, 416101 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b40a3


   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *           3        1018      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/vda2            1018       41611    20458496   8e  Linux LVM
Partition 2 does not end on cylinder boundary.


Command (m for help): q


[root@localhost ~]# 
[root@localhost ~]# fdisk -cu /dev/vda


Command (m for help): p


Disk /dev/vda: 214.7 GB, 214748364800 bytes
16 heads, 63 sectors/track, 416101 cylinders, total 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b40a3


   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048     1026047      512000   83  Linux
/dev/vda2         1026048    41943039    20458496   8e  Linux LVM


Command (m for help): h
h: unknown command
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)


Command (m for help): 
Command (m for help): 
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First sector (41943040-419430399, default 41943040): 
Using default value 41943040
Last sector, +sectors or +size{K,M,G} (41943040-419430399, default 419430399): 
Using default value 419430399


Command (m for help): 
Command (m for help): p


Disk /dev/vda: 214.7 GB, 214748364800 bytes
16 heads, 63 sectors/track, 416101 cylinders, total 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b40a3


   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048     1026047      512000   83  Linux
/dev/vda2         1026048    41943039    20458496   8e  Linux LVM
/dev/vda3        41943040   419430399   188743680   83  Linux


Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): l


 0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris        
 1  FAT12           39  Plan 9          82  Linux swap / So c1  DRDOS/sec (FAT-
 2  XENIX root      3c  PartitionMagic  83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       40  Venix 80286     84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      41  PPC PReP Boot   85  Linux extended  c7  Syrinx         
 5  Extended        42  SFS             86  NTFS volume set da  Non-FS data    
 6  FAT16           4d  QNX4.x          87  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS       4e  QNX4.x 2nd part 88  Linux plaintext de  Dell Utility   
 8  AIX             4f  QNX4.x 3rd part 8e  Linux LVM       df  BootIt         
 9  AIX bootable    50  OnTrack DM      93  Amoeba          e1  DOS access     
 a  OS/2 Boot Manag 51  OnTrack DM6 Aux 94  Amoeba BBT      e3  DOS R/O        
 b  W95 FAT32       52  CP/M            9f  BSD/OS          e4  SpeedStor      
 c  W95 FAT32 (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi eb  BeOS fs        
 e  W95 FAT16 (LBA) 54  OnTrackDM6      a5  FreeBSD         ee  GPT            
 f  W95 Ext'd (LBA) 55  EZ-Drive        a6  OpenBSD         ef  EFI (FAT-12/16/
10  OPUS            56  Golden Bow      a7  NeXTSTEP        f0  Linux/PA-RISC b
11  Hidden FAT12    5c  Priam Edisk     a8  Darwin UFS      f1  SpeedStor      
12  Compaq diagnost 61  SpeedStor       a9  NetBSD          f4  SpeedStor      
14  Hidden FAT16 <3 63  GNU HURD or Sys ab  Darwin boot     f2  DOS secondary  
16  Hidden FAT16    64  Novell Netware  af  HFS / HFS+      fb  VMware VMFS    
17  Hidden HPFS/NTF 65  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE 
18  AST SmartSleep  70  DiskSecure Mult b8  BSDI swap       fd  Linux raid auto
1b  Hidden W95 FAT3 75  PC/IX           bb  Boot Wizard hid fe  LANstep        
1c  Hidden W95 FAT3 80  Old Minix       be  Solaris boot    ff  BBT            
1e  Hidden W95 FAT1
Hex code (type L to list codes): 8e  
Changed system type of partition 3 to 8e (Linux LVM)


Command (m for help): p


Disk /dev/vda: 214.7 GB, 214748364800 bytes
16 heads, 63 sectors/track, 416101 cylinders, total 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b40a3


   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048     1026047      512000   83  Linux
/dev/vda2         1026048    41943039    20458496   8e  Linux LVM
/dev/vda3        41943040   419430399   188743680   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: Device or resource busy.
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)
Syncing disks.
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# partx -a /dev/vda
BLKPG: Device or resource busy
error adding partition 1
BLKPG: Device or resource busy
error adding partition 2
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# partx -a /dev/vda
BLKPG: Device or resource busy
error adding partition 1
BLKPG: Device or resource busy
error adding partition 2
BLKPG: Device or resource busy
error adding partition 3
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# pv
-bash: pv: command not found
[root@localhost ~]# pvs
  PV         VG       Fmt  Attr PSize  PFree
  /dev/vda2  VolGroup lvm2 a--  19.51g    0 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# pvcreate /dev/vda3
  Physical volume "/dev/vda3" successfully created
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# pvs
  PV         VG       Fmt  Attr PSize   PFree  
  /dev/vda2  VolGroup lvm2 a--   19.51g      0 
  /dev/vda3           lvm2 a--  180.00g 180.00g
[root@localhost ~]# 
[root@localhost ~]# vgextend VolGroup /dev/vda3
  Volume group "VolGroup" successfully extended
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# pvs
  PV         VG       Fmt  Attr PSize   PFree  
  /dev/vda2  VolGroup lvm2 a--   19.51g      0 
  /dev/vda3  VolGroup lvm2 a--  180.00g 180.00g
[root@localhost ~]# 
[root@localhost ~]# vgs
  VG       #PV #LV #SN Attr   VSize   VFree  
  VolGroup   2   2   0 wz--n- 199.50g 180.00g
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# lvscan
  ACTIVE            '/dev/VolGroup/lv_root' [17.51 GiB] inherit
  ACTIVE            '/dev/VolGroup/lv_swap' [2.00 GiB] inherit
[root@localhost ~]# 
[root@localhost ~]# free
             total       used       free     shared    buffers     cached
Mem:       8191532    2949448    5242084          0     183932    1182084
-/+ buffers/cache:    1583432    6608100
Swap:      2097144          0    2097144
[root@localhost ~]# 
[root@localhost ~]# lvextend -h
  lvextend: Add space to a logical volume


lvextend
        [-A|--autobackup y|n]
        [--alloc AllocationPolicy]
        [-d|--debug]
        [-f|--force]
        [-h|--help]
        [-i|--stripes Stripes [-I|--stripesize StripeSize]]
        {-l|--extents [+]LogicalExtentsNumber[%{VG|LV|PVS|FREE|ORIGIN}] |
         -L|--size [+]LogicalVolumeSize[bBsSkKmMgGtTpPeE]}
         --poolmetadatasize [+]MetadataVolumeSize[bBsSkKmMgG]}
        [-m|--mirrors Mirrors]
        [--nosync]
        [--use-policies]
        [-n|--nofsck]
        [--noudevsync]
        [-r|--resizefs]
        [-t|--test]
        [--type VolumeType]
        [-v|--verbose]
        [--version]
        LogicalVolume[Path] [ PhysicalVolumePath... ]


[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# lvextend -L 8G /dev/VolGroup/lv_swap
  Extending logical volume lv_swap to 8.00 GiB
  Logical volume lv_swap successfully resized
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# free
             total       used       free     shared    buffers     cached
Mem:       8191532    2950256    5241276          0     184284    1182244
-/+ buffers/cache:    1583728    6607804
Swap:      2097144          0    2097144
[root@localhost ~]# swapon -s
Filename                                Type            Size    Used    Priority
/dev/dm-1                               partition       2097144 0       -1
[root@localhost ~]# 
[root@localhost ~]# swapoff -a
[root@localhost ~]# swapon -s
Filename                                Type            Size    Used    Priority
[root@localhost ~]# 
[root@localhost ~]# mkswap /dev/VolGroup/lv_swap
mkswap: /dev/VolGroup/lv_swap: warning: don't erase bootbits sectors
        on whole disk. Use -f to force.
Setting up swapspace version 1, size = 8388604 KiB
no label, UUID=2fe3877a-4f15-43ff-be29-a7a848271be3
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# swapon -a
[root@localhost ~]# 
[root@localhost ~]# swapon -s
Filename                                Type            Size    Used    Priority
/dev/dm-1                               partition       8388600 0       -1
[root@localhost ~]# free
             total       used       free     shared    buffers     cached
Mem:       8191532    2950656    5240876          0     183952    1182352
-/+ buffers/cache:    1584352    6607180
Swap:      8388600          0    8388600
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# vgs
  VG       #PV #LV #SN Attr   VSize   VFree  
  VolGroup   2   2   0 wz--n- 199.50g 174.00g
[root@localhost ~]# 
[root@localhost ~]# lvscan
  ACTIVE            '/dev/VolGroup/lv_root' [17.51 GiB] inherit
  ACTIVE            '/dev/VolGroup/lv_swap' [8.00 GiB] inherit
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               199.50 GiB
  PE Size               4.00 MiB
  Total PE              51073
  Alloc PE / Size       6530 / 25.51 GiB
  Free  PE / Size       44543 / 174.00 GiB
  VG UUID               P5Xzjy-03xb-wzPe-kRuF-E0Pd-iG5r-OIEu4P
   
[root@localhost ~]# 
[root@localhost ~]# lvextend -l +44543 /dev/VolGroup/lv_root
  Extending logical volume lv_root to 191.50 GiB
  Logical volume lv_root successfully resized
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               199.50 GiB
  PE Size               4.00 MiB
  Total PE              51073
  Alloc PE / Size       51073 / 199.50 GiB
  Free  PE / Size       0 / 0   
  VG UUID               P5Xzjy-03xb-wzPe-kRuF-E0Pd-iG5r-OIEu4P
   
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# df -Ph
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root   18G  8.7G  7.7G  54% /
tmpfs                         4.0G   72K  4.0G   1% /dev/shm
/dev/vda1                     485M   39M  421M   9% /boot
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# lvscan
  ACTIVE            '/dev/VolGroup/lv_root' [191.50 GiB] inherit
  ACTIVE            '/dev/VolGroup/lv_swap' [8.00 GiB] inherit
[root@localhost ~]# 
[root@localhost ~]# resize2fs /dev/VolGroup/lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/VolGroup/lv_root is mounted on /; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 12
Performing an on-line resize of /dev/VolGroup/lv_root to 50201600 (4k) blocks.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值