CentOS 6.4 Expansion

Source: Internet
Author: User

Excerpt from: http://cache.baiducontent.com/c?m= 9f65cb4a8c8507ed4fece7631046893b4c4380146d96864968d4e414c4224615172da2fa663f4344959e2d3956b21f0baca36d2c761e26b69fca894ad cbe866d72c8713b214bda074f920eafba5153c337e751fede1ff0cdf02592dec5a3af4327b944040a9781894d731fdd1efa034795b19939550807bb9d 2765894e7659df7413e01ca5b5256e76c7ac8a4b4cb268832157cce96eed6205b562e24c4b7a13b74cc05c027d6eb71930ff35785fd4b14ae75b2e006 3eb08a4b9b0b5ef5f8dacfd30ebedcbde79c224bd94&p=863fc64ad49c0eb419bd9b7e0e159d&newp= c33ec64ad4db11a058ee97264f4a85231610db2151d4da1067&user=baidu&fm=sc&query=centos+%d0%e9%c4%e2%bb% Fa%c0%a9%c8%dd+re%2dreading+the+partition+table+failed+with+error+16%3a+device+or+resource+busy%2e&qid= A5323d5b000035f6&p1=1

The situation is exactly the same, save yourself to see it!

======================================================== background:The development server is a virtual machine, originally only planned 2G, and later found that the hard disk is not enough, need to expand. Reference article: "Actual Linux virtual machine root space expansion" http://blog.sina.com.cn/s/blog_709919050100wap1.html Note:Please read the reference article first, this article is on its foundation, in different environments in the case. At the same time, there are several places in the original is not explained so clearly, beginners may be detours, where the corresponding supplement. ======================================================== see the article that must be based on LVM, that is not it? order to check. Said CentOSThe default installation is also LVM. [Email protected] ~]$ Lvdisplay---Logical volume---
LV Path/dev/vg_vm/lv_root
LV Name Lv_root
VG Name VG_VM
LV UUID Bwylly-hyra-7hpc-2eu9-txmh-fjfa-7zldof
LV Write Access Read/write
LV Creation Host, Time Vm.sss, 2015-01-05 03:29:55 +0800
LV Status Available
# open 1
LV Size 6.71 GiB
Current LE 1718
Segments 1
Allocation inherit
Read ahead Sectors Auto
-Currently set to 256
Block Device 253:0

---Logical volume---
LV Path/dev/vg_vm/lv_swap
LV Name Lv_swap
VG Name VG_VM
LV UUID OLJ3CQ-USD7-JIGZ-HMJZ-NLMA-AQF6-LECYYC
LV Write Access Read/write
LV Creation Host, Time Vm.sss, 2015-01-05 03:29:56 +0800
LV Status Available
# open 1
LV Size 816.00 MiB
Current LE 204
Segments 1
Allocation inherit
Read ahead Sectors Auto
-Currently set to 256
Block device 253:1[[email protected] ~]$ sudo fdisk-lDISK/DEV/SDA: 32.2 GB, 32212254720 bytes
255 heads, Sectors/track, 3916 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00036057

Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 512000 Linux
Partition1 does not end on cylinder boundary.
/dev/sda2 1045 7875584 8e Linux LVM

Disk /dev/mapper/vg_vm-lv_root: 7205 MB, 7205814272 bytes
255 heads, Sectors/track, 876 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000


Disk /dev/mapper/vg_vm-lv_swap: 855 MB, 855638016 bytes
255 heads, Sectors/track, 104 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000 Then, on the Windows virtual Machine management software, give Virtual Machine Expansion--If you shut down the virtual machine OS. A 30G, of course, after entering, you can see the total capacity increased. To 32G, still did not find the new partition, the virtual machine software has been reminded. [Email protected] ~]$ sudo fdisk/dev/sda      Command (M for help): W
the Partition Tablehas been altered!

Calling IOCTL () to re-read Partition Table.

WARNING: re-reading the Partition TableFailed with error 16:device or resource busy.
theKernel still uses theOld Table. theNew Tablewould be used at
The next reboot or after you run Partprobe (8) or KPARTX (8)
Syncing disks. This is the last step. But we found out, fdisk-l, that this partition has come out.
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 512000 Linux
Partition1 does not end on cylinder boundary.
/dev/sda2 1045 7875584 8e Linux LVM
/dev/sda3 1045 3916 23066662 -up Linux   of course, this time with Ls/dev can not see SD3. Because it's not formatted yet. sudo mkfs-t Ext3/dev/sda3 is now also an error. Could not stat/dev/sdb3 or something like that. Since the last time has been prompted to reboot, then roboot a bit. [Email protected] ~]$ PartprobeThe same warning is still present. Is it still not working? Warning:warning: theKernel failed to re-read the Partition TableON/DEV/SDA (Device or resource busy). As a result, it may not be reflect all of the your changes until after reboot. Let's do the formatting. [Email protected] ~]$ sudo mkfs-t ext3/dev/sda3It's OK! Doesn't that scare people? [Email protected] ~]$ Ll/dev/sda3
BRW-RW----. 1 root disk 8, 3 Jan 6 10:33/dev/sda3 Hey, you've got it. However, look at disk space? How about these partitions [email protected] ~]$ df-h
Filesystem Size used Avail use% mounted on
/dev/mapper/vg_vm-lv_root 6.7G 6.5G 83M 99%/
Tmpfs 495M 80K 495M 1%/DEV/SHM
/DEV/SDA1 485M 326M 134M 71%/boot sudo fdisk-lYou can also find that there is only one LVM partition. Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 512000 Linux
Partition1 does not end on cylinder boundary.
/dev/sda2 1045 7875584 8e Linux LVM
/dev/sda3 1045 3916 23066662 Linux [[email protected] ~]$ sudo lvs
LV VG Attr lsize Pool Origin data% Move Log cpy%sync Convert
Lv_root Vg_vm-wi-ao----6.71g
Lv_swap vg_vm-wi-ao----816.00m [[email protected] ~]$ sudo pvcreate/dev/sda3
Dev_is_mpath:failed to get device for 8:3
Physical volume "/dev/sda3" successfully created here is a failed, thought that the problem, the results below and success, play me? Regardless of him. Because a check, is such a hint, no problem. /dev/mapper/vg_vm-lv_root6.7G 6.5G 83M 99%/
Tmpfs 495M 80K 495M 1%/DEV/SHM
/DEV/SDA1 485M 326M 134M 71%/boot/dev/mapper/vg_vm-lv_root This should be the name of the LVM group, which is not shown in sda2. To expand the group. [Email protected] ~]$ df-h
Filesystem Size used Avail use% mounted on
/dev/mapper/vg_vm-lv_root 6.7G 6.5G 83M 99%/
Tmpfs 495M 80K 495M 1%/DEV/SHM
/DEV/SDA1 485M 326M 134M 71%/boot
[Email protected] ~]$ sudo vgextend/dev/mapper/vg_vm-lv_root/dev/sda3
Volume group name Vg_vm/lv_root has invalid characters
[Email protected] ~]$ sudo vgextend/dev/mapper/vg_vm/dev/sda3
Volume Group "VG_VM" successfully extended originally this group name, is-before the string-this if no article looked at the comparative analysis, who knows AH? [Email protected] ~]$ sudo vgdisplay
---Volume Group---
VG Name VG_VM
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
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 29.50 GiB
PE Size 4.00 MiB
Total PE 7553
Alloc pe/size 1922/7.51 GiB
Free pe/size 5631/22.00 GiB
VG UUID 8GWL0O-DTDC-LMKC-GCCC-RBVV-YOQP-WMGPEQ [[email protected] ~]$ sudo lvextend-l +22g/dev/vg_vm/lv_root/dev/sda3
Extending logical Volume Lv_root to 28.71 GiB
Insufficient free space:5632 extents needed, but only 5631 available It is estimated that this is part of the use. 22G's not that accurate. Then it's 21.0G.[Email protected] ~]$ sudo lvextend-l +21.9g/dev/vg_vm/lv_root/dev/sda3Rounding size to boundary between physical extents:21.90 GiB
Extending logical Volume Lv_root to 28.61 GiB
Logical Volume Lv_root successfully resized this one step, not very clear. Is there any change in the contents? Because see a mapper I did not control him, and did not modify the file, and then continue down. [Email protected] ~]$ sudo e2fsck-f/dev/vg_vm/lv_root
E2fsck 1.41.12 (17-may-2010)
/dev/vg_vm/lv_root is mounted.
E2fsck:cannot continue, aborting. I do not know why the error. But this is just a check order, go ahead. [Email protected] ~]$ sudo resize2fs/dev/vg_vm/lv_root
RESIZE2FS 1.41.12 (17-may-2010)
Filesystem at/dev/vg_vm/lv_root is mounted on/; On-line resizing required
Old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of/dev/vg_vm/lv_root to 7500800 (4k) blocks.
theFileSystem On/dev/vg_vm/lv_root is now 7500800 blocks long.

[Email protected] ~]$ df-h
Filesystem Size used Avail use% mounted on
/dev/mapper/vg_vm-lv_root 29G 6.5G 22G 24%/
Tmpfs 495M 80K 495M 1%/DEV/SHM
/DEV/SDA1 485M 326M 134M 71%/boot You can see that this logical volume has been successfully expanded, and the root directory can be loaded with more things. yeah! ==========================================================================

CentOS 6.4 Expansion

Related Article

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.