将其他磁盤分區加入邏輯卷并更改邏輯卷大小
9.将/dev/sde分區
[root@lyt ~]# fdisk /dev/sde
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.
The number of cylinders for this disk is set to 2610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
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-2610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610): +512M
Command (m for help): p
Disk /dev/sde: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sde1 1 63 506016 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
10.更改磁盤分區類型:
The number of cylinders for this disk is set to 2610.
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)
/dev/sde1 1 63 506016 8e Linux LVM
11.将/dev/sde1加入到實體卷中
[root@lyt ~]# pvcreate /dev/sde1
Physical volume "/dev/sde1" successfully created
12.将擴充卷組
[root@lyt ~]# vgextend vgtest /dev/sde1
/dev/cdrom: open failed: Read-only file system
Attempt to close device '/dev/cdrom' which is not open.
Volume group "vgtest" successfully extended
13.擴充邏輯卷lvtest的大小(有2中方法)
(1)将邏輯卷/dev/vgtest/lvtest的大小擴充為1500M
[root@lyt ~]# lvextend -L 1500M /dev/vgtest/lvtest
Extending logical volume lvtest to 1.46 GB
Logical volume lvtest successfully resized
(2)将邏輯卷/dev/vgtest/lvtest的大小增加12M
[root@lyt ~]# lvextend -L+12M /dev/vgtest/lvtest
Extending logical volume lvtest to 1.48 GB
14.重新讀取邏輯卷大小
[root@lyt ~]# resize2fs /dev/vgtest/lvtest
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/vgtest/lvtest is mounted on /lvdate; on-line resizing required
Performing an on-line resize of /dev/vgtest/lvtest to 387072 (4k) blocks.
The filesystem on /dev/vgtest/lvtest is now 387072 blocks long.
15.減小邏輯卷大小(有2種方法)
[root@lyt ~]# umount /dev/vgtest/lvtest #首先解除安裝邏輯卷
(1)将邏輯卷的大小減小到1500M
[root@lyt ~]# lvreduce -L 1500M /dev/vgtest/lvtest #将邏輯卷減小到1500M
WARNING: Reducing active logical volume to 1.46 GB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lvtest? [y/n]: y
Reducing logical volume lvtest to 1.46 GB
(2)将邏輯卷的大小減小100M
[root@lyt ~]# lvreduce -L-100M /dev/vgtest/lvtest
WARNING: Reducing active logical volume to 1.37 GB
Reducing logical volume lvtest to 1.37 GB
16.清除邏輯卷(邏輯卷必須解除安裝後才能清除)
[root@lyt ~]# lvremove /dev/vgtest/lvtest
Do you really want to remove active logical volume lvtest? [y/n]: y
Logical volume "lvtest" successfully removed
17.清除卷組
[root@lyt ~]# vgremove /dev/vgtest
Volume group "vgtest" successfully removed
18.清除實體卷
[root@lyt ~]# pvremove /dev/sd* #将實體卷全部清除
Physical Volume /dev/sda not found
No physical volume label read from /dev/sda1
Physical Volume /dev/sda1 not found
Can't pvremove physical volume "/dev/sda2" of volume group "VolGroup00" without -ff
Physical Volume /dev/sdb not found
Labels on physical volume "/dev/sdb1" successfully wiped
Labels on physical volume "/dev/sdb2" successfully wiped
Physical Volume /dev/sdc not found
Labels on physical volume "/dev/sdc1" successfully wiped
Labels on physical volume "/dev/sdc2" successfully wiped
Physical Volume /dev/sdd not found
Labels on physical volume "/dev/sdd1" successfully wiped
Labels on physical volume "/dev/sdd2" successfully wiped
Physical Volume /dev/sde not found
Labels on physical volume "/dev/sde1" successfully wiped
19.浏覽實體卷、卷組和邏輯卷的指令分别有:
pvscan和pvdisplay、vgscan和vgdisplay、lvscan和lvdisplay
本文轉自 liuyatao666 51CTO部落格,原文連結:http://blog.51cto.com/5503845/1124332,如需轉載請自行聯系原作者