How Linux disks extend the LVM format without damaging the data

Source: Internet
Author: User
Tags uuid hex code

Mode: LVM mode

The first step is to increase the partition:
1, vm-> edit settings, disk expansion under the Disk (menu operation no longer redundant).
2. Use the FDISK command
Fdisk/dev/sda
# Use the n command to build a P-type disk, and then change the ID to 8e (LVM category) with the T command.
# p Check:
disk/dev/sda:17.1 GB, 17179869184 bytes
255 heads, Sectors/track, 2088 cylinders
Units = Cylinders of 16065 * 8225280 bytes

Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 104391 Linux
/dev/sda2 1044 8281507+ 8e Linux LVM
/dev/sda3 1045 1545 4024282+ 8e Linux LVM
Last W Save
3, restart the server, or not mount the new Sda3, SDA4,

The second step is to add VLM:
Root#mkfs.ext3/dev/sda3 # #格式化新增的分区)

Root#lvm
Lvm>pvcreate/dev/sda3 # #创建LVM硬分区
Physical volume "/dev/sda3" successfully created
lvm> vgextend Volgroup00/dev/sda3 # #加入与/directory with one LVM group
Volume Group "VolGroup00" successfully extended
Take a look:
Lvm>pvdisplay
---physical volume---
PV Name/dev/sda2
VG Name VolGroup00
PV Size 7.90 gb/not usable 23.41 MB
Allocatable Yes (but full)
PE Size (KByte) 32768
Total PE 252
Free PE 0
Allocated PE 252
PV UUID UA5FJN-JSLL-BGKP-W0XO-N8JG-MBR0-1YDZGW

---physical volume---
PV Name/dev/sda3
VG Name VolGroup00
PV Size 3.84 gb/not usable 25.96 MB
Allocatable Yes
PE Size (KByte) 32768
Total PE 122
Free PE 122
Allocated PE 0
PV UUID mhkwzk-mq1o-jkqb-0dzc-pvqw-w2r9-14y19g
Virtual disk that turns Sda3 into LVM (the key to increasing capacity)
Lvm>vgextend/dev/volgroup00/logvol102/dev/sda3
Third Step Add/catalog capacity
Lvm> lvextend-l +3.8g/dev/volgroup00/logvol00
Rounding up size to full physical extent 3.81 GB
Extending logical Volume LogVol00 to 9.69 GB
Logical Volume LogVol00 successfully resized
# resize2fs/dev/volgroup00/logvol00 # #还要重新一下识别磁盘容量
RESIZE2FS 1.39 (29-may-2006)
Filesystem at/dev/volgroup00/logvol00 is mounted on/; On-line resizing required
Performing an on-line resize of/dev/volgroup00/logvol00 to 2539520 (4k) blocks.
The filesystem on/dev/volgroup00/logvol00 is now 2539520 blocks long.

Final Confirmation Result:
Lvm> Lvdisplay
---Logical volume---
LV name/dev/volgroup00/logvol00
VG Name VolGroup00
LV UUID r9eg4x-njbd-z2ht-lml2-2l81-p3xv-kvd0e4
LV Write Access Read/write
LV Status Available
# open 1
LV Size 9.69 GB
Current LE 310
Segments 2
Allocation inherit
Read ahead Sectors Auto
-Currently set to 256
Block Device 253:0

Add a new hard drive

1. Before adding a VM, and then editing the VM properties, adding a vritual disk (SCSI), is actually adding a vdisk file.

Hard Disk2 is my new addition.

2. View the current disk structure

[Email protected] ~]# fdisk-l

disk/dev/sda:10.7 GB, 10737418240 bytes
255 heads, Sectors/track, 1305 cylinders
Units = Cylinders of 16065 * 8225280 bytes

Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 104391 Linux
/dev/sda2 905 7164990 Linux

disk/dev/sdb:1073 MB, 1073741824 bytes
255 heads, Sectors/track, cylinders
Units = Cylinders of 16065 * 8225280 bytes

Disk/dev/sdb doesn ' t contain a valid partition table
Description Disk/dev/sdb is not yet recognized by the system

3. Partition

[Email protected] ~]# FDISK/DEV/SBD

Command (M for Assist): N//input m get help information, n create partition
Command Action
E Extended
P primary partition (1-4)
P//Create primary partition
Partition number (1-4): 1//Specify the starting cylinder of the partition
First cylinder (1-130, default 1):
Using Default value 1
Last cylinder or +size or +sizem or +sizek (1-130, default 130)://Set partition capacity, direct carriage return means all
Using Default Value 130

Command (M for help): t//change the system ID of a partition
Selected partition 1
Hex Code (Type L to list codes): L//view hex for file type

Extended//linux ext3 hex of Linux is 85

Hex code (type L to list codes): 85
Cannot change a partition to an extended one or vice versa
Delete it first.

Command (M for help): P//Lists the partition of the current hard disk

disk/dev/sdb:1073 MB, 1073741824 bytes
255 heads, Sectors/track, cylinders
Units = Cylinders of 16065 * 8225280 bytes

Device Boot Start End Blocks Id System
/DEV/SDB1 1 1044193+ Linux

Command (M for help): w//Save
The partition table has been altered!

Calling IOCTL () to re-read partition table.
Syncing disks.

4. View the current partition

[Email protected] ~]# fdisk-l

disk/dev/sda:10.7 GB, 10737418240 bytes
255 heads, Sectors/track, 1305 cylinders
Units = Cylinders of 16065 * 8225280 bytes

Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 104391 Linux
/dev/sda2 905 7164990 Linux

disk/dev/sdb:1073 MB, 1073741824 bytes
255 heads, Sectors/track, cylinders
Units = Cylinders of 16065 * 8225280 bytes

Device Boot Start End Blocks Id System
/DEV/SDB1 1 1044193+ Linux

5. formatting partitions

[[email protected] ~]# MKFS.EXT3/DEV/SDB1//format into EXT3 format

6. Mount Partition

[Email protected] ~]# mount/dev/sdb1/tmp
[Email protected] ~]# DF-H/tmp
Filesystem Size used Avail use% mounted on
/DEV/SDB1 1004M 1.3M 952M 1%/tmp

7. Auto Mount

Modify/etc/fstab

Add a row

/DEV/SDB1/SDB1 ext3 defaults 0 0
Re-up

This article is from the "Technical Achievement Dream" blog, please be sure to keep this source http://pizibaidu.blog.51cto.com/1361909/1641695

How Linux disks extend the LVM format without damaging the data

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.