Chinaunix首页 | 论坛 | 博客
  • 博客访问: 43857
  • 博文数量: 15
  • 博客积分: 350
  • 博客等级: 一等列兵
  • 技术积分: 180
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-12 20:37
文章分类

全部博文(15)

文章存档

2011年(15)

我的朋友

分类: LINUX

2011-06-09 09:37:42

 
[root@localhost ~]# fdisk -l
Disk /dev/hda: 1073 MB, 1073741824 bytes
16 heads, 63 sectors/track, 2080 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Disk /dev/hda doesn't contain a valid partition table
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table

[root@localhost ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-130, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130):
Using default value 130
Command (m for help): p
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         130     1044193+  83  Linux
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         130     1044193+  8e  Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
 
[root@localhost ~]# fdisk /dev/hda
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2080, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2080, default 2080):
Using default value 2080
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/hda: 1073 MB, 1073741824 bytes
16 heads, 63 sectors/track, 2080 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/hda1               1        2080     1048288+  8e  Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
 
[root@localhost ~]# fdisk /dev/sdc
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-261, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-261, default 261): +500M
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (63-261, default 63):
Using default value 63
Last cylinder or +size or +sizeM or +sizeK (63-261, default 261): +100M
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
e
Partition number (1-4): 4
First cylinder (76-261, default 76):
Using default value 76
Last cylinder or +size or +sizeM or +sizeK (76-261, default 261):
Using default value 261
Command (m for help): p
Disk /dev/sdc: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1          62      497983+  83  Linux
/dev/sdc2              63          75      104422+  83  Linux
/dev/sdc4              76         261     1494045    5  Extended
Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (76-261, default 76):
Using default value 76
Last cylinder or +size or +sizeM or +sizeK (76-261, default 261):
+100M
Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (89-261, default 89):
Using default value 89
Last cylinder or +size or +sizeM or +sizeK (89-261, default 261):
+100M
Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (102-261, default 102):
Using default value 102
Last cylinder or +size or +sizeM or +sizeK (102-261, default 261):
+100M
Command (m for help): p
Disk /dev/sdc: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1          62      497983+  83  Linux
/dev/sdc2              63          75      104422+  83  Linux
/dev/sdc4              76         261     1494045    5  Extended
/dev/sdc5              76          88      104391   83  Linux
/dev/sdc6              89         101      104391   83  Linux
/dev/sdc7             102         114      104391   83  Linux
Command (m for help): t
Partition number (1-7): 1
Hex code (type L to list codes): l
 0  Empty           1e  Hidden W95 FAT1 80  Old Minix       be  Solaris boot  
 1  FAT12           24  NEC DOS         81  Minix / old Lin bf  Solaris       
 2  XENIX root      39  Plan 9          82  Linux swap / So c1  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  83  Linux           c4  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
 5  Extended        41  PPC PReP Boot   85  Linux extended  c7  Syrinx        
 6  FAT16           42  SFS             86  NTFS volume set da  Non-FS data   
 7  HPFS/NTFS       4d  QNX4.x          87  NTFS volume set db  CP/M / CTOS / .
 8  AIX             4e  QNX4.x 2nd part 88  Linux plaintext de  Dell Utility  
 9  AIX bootable    4f  QNX4.x 3rd part 8e  Linux LVM       df  BootIt        
 a  OS/2 Boot Manag 50  OnTrack DM      93  Amoeba          e1  DOS access    
 b  W95 FAT32       51  OnTrack DM6 Aux 94  Amoeba BBT      e3  DOS R/O       
 c  W95 FAT32 (LBA) 52  CP/M            9f  BSD/OS          e4  SpeedStor     
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi eb  BeOS fs       
 f  W95 Ext'd (LBA) 54  OnTrackDM6      a5  FreeBSD         ee  EFI GPT       
10  OPUS            55  EZ-Drive        a6  OpenBSD         ef  EFI (FAT-12/16/
11  Hidden FAT12    56  Golden Bow      a7  NeXTSTEP        f0  Linux/PA-RISC b
12  Compaq diagnost 5c  Priam Edisk     a8  Darwin UFS      f1  SpeedStor     
14  Hidden FAT16 <3 61  SpeedStor       a9  NetBSD          f4  SpeedStor     
16  Hidden FAT16    63  GNU HURD or Sys ab  Darwin boot     f2  DOS secondary 
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fd  Linux raid auto
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fe  LANstep       
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid ff  BBT           
1c  Hidden W95 FAT3 75  PC/IX  
Command (m for help): t
Partition number (1-7): 1      
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): t
Partition number (1-7): 2
Hex code (type L to list codes): 8e
Changed system type of partition 2 to 8e (Linux LVM)
Command (m for help): t
Partition number (1-7): 5
Hex code (type L to list codes): 8e
Changed system type of partition 5 to 8e (Linux LVM)
Command (m for help): t
Partition number (1-7): 6
Hex code (type L to list codes): 8e
Changed system type of partition 6 to 8e (Linux LVM)
Command (m for help): t
Partition number (1-7): 7
Hex code (type L to list codes): 8e
Changed system type of partition 7 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sdc: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1          62      497983+  8e  Linux LVM
/dev/sdc2              63          75      104422+  8e  Linux LVM
/dev/sdc4              76         261     1494045    5  Extended
/dev/sdc5              76          88      104391   8e  Linux LVM
/dev/sdc6              89         101      104391   8e  Linux LVM
/dev/sdc7             102         114      104391   8e  Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
 
[root@localhost ~]# fdisk -l
Disk /dev/hda: 1073 MB, 1073741824 bytes
16 heads, 63 sectors/track, 2080 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/hda1               1        2080     1048288+  8e  Linux LVM
Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         130     1044193+  8e  Linux LVM
Disk /dev/sdc: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1          62      497983+  8e  Linux LVM
/dev/sdc2              63          75      104422+  8e  Linux LVM
/dev/sdc4              76         261     1494045    5  Extended
/dev/sdc5              76          88      104391   8e  Linux LVM
/dev/sdc6              89         101      104391   8e  Linux LVM
/dev/sdc7             102         114      104391   8e  Linux LVM
[root@localhost ~]# pvcreate /dev/hda1
  Physical volume "/dev/hda1" successfully created

[root@localhost ~]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created

[root@localhost ~]# pvcreate /dev/sdc1
  Physical volume "/dev/sdc1" successfully created

[root@localhost ~]# pvcreate /dev/sdc2
  Physical volume "/dev/sdc2" successfully created

[root@localhost ~]# pvcreate /dev/sdc5
  Physical volume "/dev/sdc5" successfully created

[root@localhost ~]# pvcreate /dev/sdc6
  Physical volume "/dev/sdc6" successfully created

[root@localhost ~]# pvcreate /dev/sdc7
  Physical volume "/dev/sdc7" successfully created
 
[root@localhost ~]# pvscan
  /dev/cdrom: open failed: Read-only file system
  Attempt to close device '/dev/cdrom' which is not open.
  PV /dev/hda1                   lvm2 [1023.72 MB]
  PV /dev/sdb1                   lvm2 [1019.72 MB]
  PV /dev/sdc1                   lvm2 [486.31 MB]
  PV /dev/sdc2                   lvm2 [101.98 MB]
  PV /dev/sdc5                   lvm2 [101.94 MB]
  PV /dev/sdc6                   lvm2 [101.94 MB]
  PV /dev/sdc7                   lvm2 [101.94 MB]
  Total: 8 [10.74 GB] / in use: 1 [7.88 GB] / in no VG: 7 [2.87 GB]

[root@localhost ~]# pvdisplay  /dev/hda1
  "/dev/hda1" is a new physical volume of "1023.72 MB"
  --- NEW Physical volume ---
  PV Name               /dev/hda1
  VG Name              
  PV Size               1023.72 MB
  Allocatable           NO
  PE Size (KByte)       0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               9botjL-aicU-NQBw-ttjA-NR4D-x8yD-Iq4fEF
  
[root@localhost ~]# pvdisplay  /dev/sdb1
  "/dev/sdb1" is a new physical volume of "1019.72 MB"
  --- NEW Physical volume ---
  PV Name               /dev/sdb1
  VG Name              
  PV Size               1019.72 MB
  Allocatable           NO
  PE Size (KByte)       0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               1ZuJ1K-vjsa-eBMR-la2C-rhbg-C5H5-OckpZO
  
[root@localhost ~]# pvdisplay  /dev/sdc1
  "/dev/sdc1" is a new physical volume of "486.31 MB"
  --- NEW Physical volume ---
  PV Name               /dev/sdc1
  VG Name              
  PV Size               486.31 MB
  Allocatable           NO
  PE Size (KByte)       0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               K213Ir-kjNj-mnUf-DEJa-Nq68-C1g0-0Up3eO
  
[root@localhost ~]# pvdisplay  /dev/sdc2
  "/dev/sdc2" is a new physical volume of "101.98 MB"
  --- NEW Physical volume ---
  PV Name               /dev/sdc2
  VG Name              
  PV Size               101.98 MB
  Allocatable           NO
  PE Size (KByte)       0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               l8H4uF-rCSG-Src7-PyFR-TF1k-lYBQ-NHxpQl
  
[root@localhost ~]# pvdisplay  /dev/sdc5
  "/dev/sdc5" is a new physical volume of "101.94 MB"
  --- NEW Physical volume ---
  PV Name               /dev/sdc5
  VG Name              
  PV Size               101.94 MB
  Allocatable           NO
  PE Size (KByte)       0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               493Rod-bOgB-kj4a-OX08-waDP-Epf4-sg96up
  
[root@localhost ~]# pvdisplay  /dev/sdc6
  "/dev/sdc6" is a new physical volume of "101.94 MB"
  --- NEW Physical volume ---
  PV Name               /dev/sdc6
  VG Name              
  PV Size               101.94 MB
  Allocatable           NO
  PE Size (KByte)       0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               edXRlb-a3t1-ZAok-a53V-wmqi-P6bJ-UfjIO8
  
[root@localhost ~]# pvdisplay  /dev/sdc7
  "/dev/sdc7" is a new physical volume of "101.94 MB"
  --- NEW Physical volume ---
  PV Name               /dev/sdc7
  VG Name              
  PV Size               101.94 MB
  Allocatable           NO
  PE Size (KByte)       0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               8YwWMc-ou8j-nbuF-UGxw-cNiB-JzJh-FoMhN9
   
  
[root@localhost ~]# vgcreate demoVG1 /dev/hda1 /dev/sdb1
  Volume group "demoVG1" successfully created

[root@localhost ~]# vgscan
  Reading all physical volumes.  This may take a while...
  /dev/cdrom: open failed: Read-only file system
  Attempt to close device '/dev/cdrom' which is not open.
  Found volume group "demoVG1" using metadata type lvm2

[root@localhost ~]# vgdisplay
  
  --- Volume group ---
  VG Name               demoVG1
  System ID            
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               1.99 GB
  PE Size               4.00 MB
  Total PE              509
  Alloc PE / Size       0 / 0  
  Free  PE / Size       509 / 1.99 GB
  VG UUID               fWjE08-2E1k-SDGO-wAoA-lo1G-m5zk-OhZ8w5
  
[root@localhost ~]# pvscan
  /dev/cdrom: open failed: Read-only file system
  Attempt to close device '/dev/cdrom' which is not open.
  PV /dev/hda1   VG demoVG1      lvm2 [1020.00 MB / 1020.00 MB free]
  PV /dev/sdb1   VG demoVG1      lvm2 [1016.00 MB / 1016.00 MB free
]
  PV /dev/sdc1                   lvm2 [486.31 MB]
  PV /dev/sdc2                   lvm2 [101.98 MB]
  PV /dev/sdc5                   lvm2 [101.94 MB]
  PV /dev/sdc6                   lvm2 [101.94 MB]
  PV /dev/sdc7                   lvm2 [101.94 MB]
  Total: 8 [10.74 GB] / in use: 3 [9.86 GB] / in no VG: 5 [894.12 MB]
 
[root@localhost ~]# vgextend demoVG1 /dev/sdc1
  /dev/cdrom: open failed: Read-only file system
  Attempt to close device '/dev/cdrom' which is not open.
  Volume group "demoVG1" successfully extended
 
[root@localhost ~]# pvscan
  /dev/cdrom: open failed: Read-only file system
  Attempt to close device '/dev/cdrom' which is not open.
  PV /dev/hda1   VG demoVG1      lvm2 [1020.00 MB / 1020.00 MB free]
  PV /dev/sdb1   VG demoVG1      lvm2 [1016.00 MB / 1016.00 MB free]
  PV /dev/sdc1   VG demoVG1      lvm2 [484.00 MB / 484.00 MB free]
  PV /dev/sdc2                   lvm2 [101.98 MB]
  PV /dev/sdc5                   lvm2 [101.94 MB]
  PV /dev/sdc6                   lvm2 [101.94 MB]
  PV /dev/sdc7                   lvm2 [101.94 MB]
  Total: 8 [10.73 GB] / in use: 4 [10.34 GB] / in no VG: 4 [407.81 MB]

[root@localhost ~]# vgreduce demoVG1 /dev/sdc1
  Removed "/dev/sdc1" from volume group "demoVG1"

[root@localhost ~]# pvscan
  /dev/cdrom: open failed: Read-only file system
  Attempt to close device '/dev/cdrom' which is not open.
  PV /dev/hda1   VG demoVG1      lvm2 [1020.00 MB / 1020.00 MB free]
  PV /dev/sdb1   VG demoVG1      lvm2 [1016.00 MB / 1016.00 MB free]
  PV /dev/sdc1                   lvm2 [486.31 MB]
  PV /dev/sdc2                   lvm2 [101.98 MB]
  PV /dev/sdc5                   lvm2 [101.94 MB]
  PV /dev/sdc6                   lvm2 [101.94 MB]
  PV /dev/sdc7                   lvm2 [101.94 MB]
  Total: 8 [10.74 GB] / in use: 3 [9.86 GB] / in no VG: 5 [894.12 MB]

[root@localhost ~]# vgcreate demoVG2 /dev/sdc1 /dev/sdc2
  Volume group "demoVG2" successfully created

[root@localhost ~]# vgcreate demoVG3 /dev/sdc5 /dev/sdc6 /dev/sdc7
  Volume group "demoVG3" successfully created
  
[root@localhost ~]# pvscan
  /dev/cdrom: open failed: Read-only file system
  Attempt to close device '/dev/cdrom' which is not open.
  PV /dev/sdc5   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc6   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc7   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc1   VG demoVG2      lvm2 [484.00 MB / 484.00 MB free]
  PV /dev/sdc2   VG demoVG2      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/hda1   VG demoVG1      lvm2 [1020.00 MB / 1020.00 MB free]
  PV /dev/sdb1   VG demoVG1      lvm2 [1016.00 MB / 1016.00 MB free]
  Total: 8 [10.73 GB] / in use: 8 [10.73 GB] / in no VG: 0 [0   ]

[root@localhost ~]# vgscan
  Reading all physical volumes.  This may take a while...
  /dev/cdrom: open failed: Read-only file system
  Attempt to close device '/dev/cdrom' which is not open.
  Found volume group "demoVG3" using metadata type lvm2
  Found volume group "demoVG2" using metadata type lvm2
  Found volume group "demoVG1" using metadata type lvm2

[root@localhost ~]# vgdisplay
  --- Volume group ---
  VG Name               demoVG3
  System ID            
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               300.00 MB
  PE Size               4.00 MB
  Total PE              75
  Alloc PE / Size       0 / 0  
  Free  PE / Size       75 / 300.00 MB
  VG UUID               gr7ahD-L0b6-veck-FdsY-p6HX-1ke5-u0Zk42
  
  --- Volume group ---
  VG Name               demoVG2
  System ID            
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               584.00 MB
  PE Size               4.00 MB
  Total PE              146
  Alloc PE / Size       0 / 0  
  Free  PE / Size       146 / 584.00 MB
  VG UUID               wbAcsY-bSF8-i0Id-5yx9-WlvX-hZrj-pCD31u
  
  --- Volume group ---
  VG Name               VolGroup00
  System ID            
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               7.88 GB
  PE Size               32.00 MB
  Total PE              252
  Alloc PE / Size       252 / 7.88 GB
  Free  PE / Size       0 / 0  
  VG UUID               WhW6vs-ocAk-qGas-tjXU-zMLC-q9SP-bvTg7Z
  
  --- Volume group ---
  VG Name               demoVG1
  System ID            
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               1.99 GB
  PE Size               4.00 MB
  Total PE              509
  Alloc PE / Size       0 / 0  
  Free  PE / Size       509 / 1.99 GB
  VG UUID               fWjE08-2E1k-SDGO-wAoA-lo1G-m5zk-OhZ8w5
  
[root@localhost ~]# lvcreate -L 200m -n demoLV1 demoVG1
  Logical volume "demoLV1" created

[root@localhost ~]# lvscan
  ACTIVE            '/dev/demoVG1/demoLV1' [200.00 MB] inherit

[root@localhost ~]# lvextend -L +200m /dev/demoVG1/demoLV1
  Extending logical volume demoLV1 to 400.00 MB
  Logical volume demoLV1 successfully resized

[root@localhost ~]# lvscan
  ACTIVE            '/dev/demoVG1/demoLV1' [400.00 MB] inherit
 
[root@localhost ~]# mkfs.ext3 /dev/demoVG1/demoLV1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
102400 inodes, 409600 blocks
20480 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67633152
50 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
Writing inode tables: done                           
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
 
[root@localhost /]# mkdir storage
[root@localhost /]#
mount /dev/demoVG1/demoLV1 /storage/

[root@localhost /]# df -lh
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol01
                      5.7G  2.3G  3.2G  42% /
/dev/sda1              99M   19M   75M  20% /boot
tmpfs                 233M     0  233M   0% /dev/shm
/dev/mapper/demoVG1-demoLV1
                      388M   11M  358M   3% /storage
[root@localhost /]# mount
/dev/mapper/demoVG1-demoLV1 on /storage type ext3 (rw)
 
[root@localhost /]# cat /etc/fstab

/dev/mapper/demoVG1-demoLV1         /storage        ext3    defaults        0 0

[root@localhost /]# lvextend -L +200m /dev/demoVG1/demoLV1
  Extending logical volume demoLV1 to 600.00 MB
  Logical volume demoLV1 successfully resized
 
[root@localhost storage]# pvscan
  /dev/cdrom: open failed: Read-only file system
  Attempt to close device '/dev/cdrom' which is not open.
  PV /dev/sdc5   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc6   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc7   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc1   VG demoVG2      lvm2 [484.00 MB / 484.00 MB free]
  PV /dev/sdc2   VG demoVG2      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/hda1   VG demoVG1      lvm2 [1020.00 MB / 20.00 MB free]
  PV /dev/sdb1   VG demoVG1      lvm2 [1016.00 MB / 1016.00 MB free]
  Total: 8 [10.73 GB] / in use: 8 [10.73 GB] / in no VG: 0 [0   ]
[root@localhost storage]# lvscan 
    ACTIVE            '/dev/demoVG1/demoLV1' [1000.00 MB] inherit

[root@localhost storage]# df -lh
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol01
                      5.7G  2.3G  3.2G  42% /
/dev/sda1              99M   19M   75M  20% /boot
tmpfs                 233M     0  233M   0% /dev/shm
/dev/mapper/demoVG1-demoLV1
                      787M   17M  733M   3% /storage
 
[root@localhost storage]# resize2fs /dev/demoVG1/demoLV1
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/demoVG1/demoLV1 is mounted on /storage; on-line resizing required
Performing an on-line resize of /dev/demoVG1/demoLV1 to 256000 (4k) blocks.
The filesystem on /dev/demoVG1/demoLV1 is now 256000 blocks long.
 
[root@localhost storage]# df -lh
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol01
                      5.7G  2.3G  3.2G  42% /
/dev/sda1              99M   19M   75M  20% /boot
tmpfs                 233M     0  233M   0% /dev/shm
/dev/mapper/demoVG1-demoLV1
                      985M   17M  925M   2% /storage
 
[root@localhost storage]# pvscan
  /dev/cdrom: open failed: Read-only file system
  Attempt to close device '/dev/cdrom' which is not open.
  PV /dev/sdc5   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc6   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc7   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc1   VG demoVG2      lvm2 [484.00 MB / 484.00 MB free]
  PV /dev/sdc2   VG demoVG2      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/hda1   VG demoVG1      lvm2 [1020.00 MB / 20.00 MB free]
  PV /dev/sdb1   VG demoVG1      lvm2 [1016.00 MB / 1016.00 MB free]
  Total: 8 [10.73 GB] / in use: 8 [10.73 GB] / in no VG: 0 [0   ]

[root@localhost storage]# vgscan
  Reading all physical volumes.  This may take a while...
  /dev/cdrom: open failed: Read-only file system
  Attempt to close device '/dev/cdrom' which is not open.
  Found volume group "demoVG3" using metadata type lvm2
  Found volume group "demoVG2" using metadata type lvm2
  Found volume group "demoVG1" using metadata type lvm2

[root@localhost storage]# lvscan
  ACTIVE            '/dev/demoVG1/demoLV1' [1000.00 MB] inherit
[root@localhost storage]# lvextend -L +200m /dev/demoVG1/demoLV1
  Extending logical volume demoLV1 to 1.17 GB
  Logical volume demoLV1 successfully resized
[root@localhost storage]# resize2fs /dev/demoVG1/demoLV1
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/demoVG1/demoLV1 is mounted on /storage; on-line resizing required
Performing an on-line resize of /dev/demoVG1/demoLV1 to 307200 (4k) blocks.
The filesystem on /dev/demoVG1/demoLV1 is now 307200 blocks long.
 
[root@localhost storage]# df -lh
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol01
                      5.7G  2.3G  3.2G  42% /
/dev/sda1              99M   19M   75M  20% /boot
tmpfs                 233M     0  233M   0% /dev/shm
/dev/mapper/demoVG1-demoLV1
                      1.2G   17M  1.1G   2% /storage
[root@localhost storage]# pvscan
  /dev/cdrom: open failed: Read-only file system
  Attempt to close device '/dev/cdrom' which is not open.
  PV /dev/sdc5   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc6   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc7   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc1   VG demoVG2      lvm2 [484.00 MB / 484.00 MB free]
  PV /dev/sdc2   VG demoVG2      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/hda1   VG demoVG1      lvm2 [1020.00 MB / 0    free]
  PV /dev/sdb1   VG demoVG1      lvm2 [1016.00 MB / 836.00 MB free]
  Total: 8 [10.73 GB] / in use: 8 [10.73 GB] / in no VG: 0 [0   ]
 
[root@localhost storage]# fdisk -l /dev/sdc
Disk /dev/sdc: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1          62      497983+  8e  Linux LVM
/dev/sdc2              63          75      104422+  8e  Linux LVM
/dev/sdc4              76         261     1494045    5  Extended
/dev/sdc5              76          88      104391   8e  Linux LVM
/dev/sdc6              89         101      104391   8e  Linux LVM
/dev/sdc7             102         114      104391   8e  Linux LVM
[root@localhost storage]# fdisk /dev/sdc
Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (115-261, default 115): 
Using default value 115
Last cylinder or +size or +sizeM or +sizeK (115-261, default 261):
Using default value 261
Command (m for help): p
Disk /dev/sdc: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1          62      497983+  8e  Linux LVM
/dev/sdc2              63          75      104422+  8e  Linux LVM
/dev/sdc4              76         261     1494045    5  Extended
/dev/sdc5              76          88      104391   8e  Linux LVM
/dev/sdc6              89         101      104391   8e  Linux LVM
/dev/sdc7             102         114      104391   8e  Linux LVM
/dev/sdc8             115         261     1180746   83  Linux
Command (m for help): t
Partition number (1-8): 8
Hex code (type L to list codes): 8e
Changed system type of partition 8 to 8e (Linux LVM)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost storage]# vgscan
  Reading all physical volumes.  This may take a while...
  /dev/cdrom: open failed: Read-only file system
  Attempt to close device '/dev/cdrom' which is not open.
  Found volume group "demoVG3" using metadata type lvm2
  Found volume group "demoVG2" using metadata type lvm2
  Found volume group "demoVG1" using metadata type lvm2
[root@localhost storage]# pvscan
  /dev/cdrom: open failed: Read-only file system
  Attempt to close device '/dev/cdrom' which is not open.
  PV /dev/sdc5   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc6   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc7   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc1   VG demoVG2      lvm2 [484.00 MB / 484.00 MB free]
  PV /dev/sdc2   VG demoVG2      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sda2   VG VolGroup00   lvm2 [7.88 GB / 0    free]
  PV /dev/hda1   VG demoVG1      lvm2 [1020.00 MB / 0    free]
  PV /dev/sdb1   VG demoVG1      lvm2 [1016.00 MB / 836.00 MB free]
  Total: 8 [10.73 GB] / in use: 8 [10.73 GB] / in no VG: 0 [0   ]

[root@localhost storage]# pvcreate /dev/sdc8
  Physical volume "/dev/sdc8" successfully created
[root@localhost storage]# pvscan
  /dev/cdrom: open failed: Read-only file system
  Attempt to close device '/dev/cdrom' which is not open.
  PV /dev/sdc5   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc6   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc7   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc1   VG demoVG2      lvm2 [484.00 MB / 484.00 MB free]
  PV /dev/sdc2   VG demoVG2      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/hda1   VG demoVG1      lvm2 [1020.00 MB / 0    free]
  PV /dev/sdb1   VG demoVG1      lvm2 [1016.00 MB / 836.00 MB free]
  PV /dev/sdc8                   lvm2 [1.13 GB]
  Total: 9 [11.85 GB] / in use: 8 [10.73 GB] / in no VG: 1 [1.13 GB]
 
[root@localhost storage]# vgextend demoVG1 /dev/sdc8
  /dev/cdrom: open failed: Read-only file system
  Attempt to close device '/dev/cdrom' which is not open.
  Volume group "demoVG1" successfully extended
[root@localhost storage]# vgscan
  Reading all physical volumes.  This may take a while...
  /dev/cdrom: open failed: Read-only file system
  Attempt to close device '/dev/cdrom' which is not open.
  Found volume group "demoVG3" using metadata type lvm2
  Found volume group "demoVG2" using metadata type lvm2
  Found volume group "demoVG1" using metadata type lvm2
[root@localhost storage]# pvscan
  /dev/cdrom: open failed: Read-only file system
  Attempt to close device '/dev/cdrom' which is not open.
  PV /dev/sdc5   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc6   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc7   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc1   VG demoVG2      lvm2 [484.00 MB / 484.00 MB free]
  PV /dev/sdc2   VG demoVG2      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/hda1   VG demoVG1      lvm2 [1020.00 MB / 0    free]
  PV /dev/sdb1   VG demoVG1      lvm2 [1016.00 MB / 836.00 MB free]
  PV /dev/sdc8   VG demoVG1      lvm2 [1.12 GB / 1.12 GB free]
  Total: 9 [11.85 GB] / in use: 9 [11.85 GB] / in no VG: 0 [0   ]
 
[root@localhost storage]# lvextend -L +1000m /dev/demoVG1/demoLV1
  Extending logical volume demoLV1 to 2.15 GB
  Logical volume demoLV1 successfully resized
 
[root@localhost storage]# resize2fs /dev/demoVG1/demoLV1
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/demoVG1/demoLV1 is mounted on /storage; on-line resizing required
Performing an on-line resize of /dev/demoVG1/demoLV1 to 563200 (4k) blocks.
The filesystem on /dev/demoVG1/demoLV1 is now 563200 blocks long.
 
[root@localhost storage]# df -lh
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol01
                      5.7G  2.3G  3.2G  42% /
/dev/sda1              99M   19M   75M  20% /boot
tmpfs                 233M     0  233M   0% /dev/shm
/dev/mapper/demoVG1-demoLV1
                      2.2G   17M  2.1G   1% /storage
[root@localhost storage]# pvscan
  /dev/cdrom: open failed: Read-only file system
  Attempt to close device '/dev/cdrom' which is not open.
  PV /dev/sdc5   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc6   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc7   VG demoVG3      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdc1   VG demoVG2      lvm2 [484.00 MB / 484.00 MB free]
  PV /dev/sdc2   VG demoVG2      lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sda2   VG VolGroup00   lvm2 [7.88 GB / 0    free]
  PV /dev/hda1   VG demoVG1      lvm2 [1020.00 MB / 0    free]
  PV /dev/sdb1   VG demoVG1      lvm2 [1016.00 MB / 0    free]
  PV /dev/sdc8   VG demoVG1      lvm2 [1.12 GB / 988.00 MB free]
  Total: 9 [11.85 GB] / in use: 9 [11.85 GB] / in no VG: 0 [0   ]

阅读(780) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~