redhat6.2 on the LVM.
1
First, add a hard drive to RH on the virtual machine.
2
Start RH
3
Enter on the terminal
[beigang@localhost~] $fdisk-L
disk/dev/sdc:1073 MB, 1073741824 bytes
......
DISK/DEV/SDC doesn ' t contain a valid partition table
4
Partition 1
[beigang@localhost~] $fdisk/DEV/SDC
Command (M for help): N
Command Action
E Extended
P primary partition (1-4)
P
Partition number (1-4): 1
The cylinder (1-130, default 1):
Using Default value 1
Last cylinder, +cylinders or +size{k,m,g} (1-130, default 130): +100m
Command (M for help): W
The partition table has been altered!
Calling IOCTL () to re-read partition table.
Syncing disks.
[beigang@localhost~]$
5
View
[beigang@localhost~] $fdisk-L
Device Boot Start End Blocks Id System
/DEV/SDC1 1 112423+ Linux
6
Partition 2
[beigang@localhost~] $fdisk/DEV/SDC
N
P
2
15
+100m
W
7
View
[beigang@localhost~] $fdisk-L
Device Boot Start End Blocks Id System
/DEV/SDC1 1 112423+ Linux
/DEV/SDC2 112455 MB Linux
8
Add Physical volume
[beigang@localhost~] $pvcreate/DEV/SDC1
Writing physical volume data to disk "/DEV/SDC1"
Physical volume "/DEV/SDC1" successfully created
[beigang@localhost~] $pvcreate/DEV/SDC2
Writing physical volume data to disk "/DEV/SDC2"
Physical volume "/DEV/SDC2" successfully created
[beigang@localhost~]$
12
Create Logical Volume 1
[beigang@localhost~] $lvcreate-n lv1-l +50m VG1
Rounding up size to full physical extent 52.00 MiB
Logical volume "Lv1" created
[beigang@localhost~]$
13
Create Logical Volume 2 because it is an integer multiple of PE (4M), so there is no increase
[beigang@localhost~] $lvcreate-n lv2-l +60m VG1
Logical volume "Lv2" created
[beigang@localhost~]$
15
Format Lv1 The Times could not find the file,
[beigang@localhost~] $mkfs. ext3/dev/vg1/lv1
16
Mount Lv1
[beigang@localhost~] $mount/dev/vg1/lv1/seconddisk/
17
To generate a file on a folder Seconddisk
[beigang@localhost~] $touch/seconddisk/{1..9}.txt
[beigang@localhost~] $ll/seconddisk/
Total 23
-rw-r--r--. 1 Root 0 Nov 8 14:06 1.txt
-rw-r--r--. 1 Root 0 Nov 8 14:06 2.txt
-rw-r--r--. 1 Root 0 Nov 8 14:06 3.txt
-rw-r--r--. 1 Root 0 Nov 8 14:06 4.txt
-rw-r--r--. 1 Root 0 Nov 8 14:06 5.txt
-rw-r--r--. 1 Root 0 Nov 8 14:06 6.txt
-rw-r--r--. 1 Root 0 Nov 8 14:06 7.txt
-rw-r--r--. 1 Root 0 Nov 8 14:06 8.txt
-rw-r--r--. 1 Root 0 Nov 8 14:06 9.txt
DRWX------. 2 root 12288 Nov 8 13:51 Lost+found
[beigang@localhost~]$
18
Delete/dev/vg1/lv1,/dev/vg1/lv2
[beigang@localhost~] $lvremove/DEV/VG1/LV1
Can ' t remove open Logical Volume "LV1"
[beigang@localhost~] $umount/seconddisk/
[beigang@localhost~] $lvremove/DEV/VG1/LV1
Do your really want to remove active logical volume LV1? [y/n]: Y
Logical volume "LV1" successfully removed
[beigang@localhost~]$
[beigang@localhost~] $lvremove/dev/vg1/lv2
Do your really want to remove active logical volume LV2? [y/n]: Y
Logical volume "Lv2" successfully removed
19
Delete/DEV/VG1
[beigang@localhost~] $vgremove/DEV/VG1
Volume Group "VG1" successfully removed
[beigang@localhost~]$
It is worth saying that in the LVM, the file type does not have to be 8e,83, see the following ID.
[beigang@localhost~] $fdisk-L
Device Boot Start End Blocks Id System
/DEV/SDC1 1 112423+ Linux
/DEV/SDC2 112455 MB Linux
===================
===================
===================
The following is done on the basis of the completion of the 17th step above to Lv2 to do an extension.
1
First, Fdisk, get a/dev/sdc3.
View:
[Beigang@localhost~]$ fdisk-l | Grep/sdb
/DEV/SDC1 1 112423+ Linux
/DEV/SDC2 112455 MB Linux
/DEV/SDC3 112455 Linux
2
Increase PV Failure
[Beigang@localhost~]$ PVCREATE/DEV/SDC3
DEVICE/DEV/SDC3 not found (or ignored by filtering).
3
Load Disc partation:
[beigang@localhost~]$ partx-a/DEV/SDC
Blkpg:device or resource busy
Error adding partition 1
Blkpg:device or resource busy
Error adding partition 2
[beigang@localhost~]$ partx-a/DEV/SDC
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
4
Add PV:
[Beigang@localhost~]$ PVCREATE/DEV/SDC3
Writing physical volume data to disk "/DEV/SDC3"
Physical volume "/DEV/SDC3" successfully created
5
Extended SDB3 to VG:
[Beigang@localhost~]$ VGEXTEND/DEV/VG1/DEV/SDC3
Volume Group "VG1" successfully extended
[beigang@localhost~]$
9
Mount again to view, Lv2 only 51M, just extended has not really added
[Beigang@localhost~]$ mount/dev/vg1/lv2/mnt
[Beigang@localhost~]$ df-h
FileSystem Size Used Avail use% mounted on
/dev/mapper/vg1-lv2
51M 4.9M 43M 11%/mnt
[beigang@localhost~]$
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.