Create physical volume error can ' t OPEN/DEV/SDB5 exclusively. Mounted FileSystem's problem solving process record

Source: Internet
Author: User
Yum Server LVM expansion, the data directory is Yum storage rpm package directory, only 20G, need to add disk expansion to 80G

# DF-LH
Filesystem Size used Avail use% mounted on
/dev/mapper/vg_node5-root 20G 479M 18G 3%/
Tmpfs 935M 0 935M 0%/dev/shm
/DEV/SDA1 485M 39M 421M 9%/boot
/dev/mapper/vg_node5-data 20G 172M 19G 1%/data
/DEV/MAPPER/VG_NODE5-USR 9.7G 1.6G 7.6G 18%/usr
/dev/mapper/vg_node5-web 15G 165M 14G 2%/web


1. Add a piece of hard disk


2. Partition the hard disk, and adjust the format to 8e Linux LVM format
#Mount the system partition
# kpartx-l/dev/sdb
# KPARTX-AF/DEV/SDB
# partx-a/dev/sdb


3. Create a physical volume
When doing LVM on several disks, I encountered a problem that I had not encountered before:
# PVCREATE/DEV/SDB5
Can ' t OPEN/DEV/SDB5 exclusively. Mounted filesystem?
The first response is to see if the partition is already in use, but not.


To view some information about your hard disk:


# cat/proc/partitions
Major Minor #blocks name


8 0 83886080 SDA
8 1 512000 sda1
8 2 83373056 Sda2
8 125829120 SDB
8 1 SDB1
8 125796982 SDB5
253 0 20480000 dm-0
253 1 4096000 dm-1
253 2 15360000 Dm-2
253 3 20480000 dm-3
253 4 10240000 Dm-4
253 5 1 Dm-5
253 6 125796982 Dm-6




# fdisk/dev/sdb-l


disk/dev/sdb:128.8 GB, 128849018880 bytes
255 heads, Sectors/track, 15665 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x44c662ff


Device Boot Start End Blocks Id System
/DEV/SDB1 1 15665 125829081 5 Extended
/DEV/SDB5 5 15665 125796982+ 8e Linux LVM


Then look at some of the underlying information:


Dmsetup is an underlying logical volume management, and DM should be the abbreviation for Device Mapper.
[Root@node5/]# dmsetup Status
sdb1:0 2 Linear
vg_node5-web:0 30720000 Linear
sdb5:0 251593965 Linear
vg_node5-usr:0 20480000 Linear
vg_node5-swap:0 8192000 Linear
vg_node5-root:0 40960000 Linear
vg_node5-data:0 40960000 Linear
[Root@node5/]# Dmsetup ls
SDB1 (253:5)
Vg_node5-web (253:2)
SDB5 (253:6)
VG_NODE5-USR (253:4)
Vg_node5-swap (253:1)
Vg_node5-root (253:0)
Vg_node5-data (253:3)


For example:
root@ubuntu:~# Dmsetup ls
35000c50026716847 (254, 2)
Vg_data-lv_home (254, 0)
35000c5002670f03e (254, 3)
35000c5002670f03e-part1 (254, 5)
35000c50026716847-part1 (254, 4)
Vg_data-lv_swap (254, 1)
You can see that 35000c5002670f03e and 35000c50026716847 make up the Multipath (multipathing)




# ll/dev/mapper/
Total 0
CRW-RW----1 root root, Jul 19:51 control
lrwxrwxrwx 1 root root 7 Jul 19:59 vg_node5-data. /dm-3
lrwxrwxrwx 1 root root 7 Jul 19:59/dev/sdb1. /dm-5
lrwxrwxrwx 1 root root 7 Jul 19:59/dev/sdb5. /dm-6
lrwxrwxrwx 1 root root 7 Jul 19:59 vg_node5-root. /dm-0
lrwxrwxrwx 1 root root 7 Jul 19:59 Vg_node5-swap. /dm-1
lrwxrwxrwx 1 root root 7 Jul 19:59 vg_node5-usr. /dm-4
lrwxrwxrwx 1 root root 7 Jul 19:59 vg_node5-web. /dm-2
You can create PV with dmsetup Remove XXX:


# Dmsetup REMOVE/DEV/SDB1
# Dmsetup REMOVE/DEV/SDB5


Re-creating the physical volume successfully
root@ubuntu:~# PVCREATE/DEV/SDB5
Physical volume "/DEV/SDB5" successfully created
You can also use Dmsetup remove_all to remove all.


# Vgdisplay
---Volume Group---
VG Name VG_NODE5
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 6
VG Access Read/write
VG Status resizable
MAX LV 0
Cur LV 5
Open LV 5
Max PV 0
Cur PV 1
ACT PV 1
VG Size 79.51 GiB
PE Size 4.00 MiB
Total PE 20354
Alloc pe/size 17250/67.38 GiB
Free Pe/size 3104/12.12 GiB
VG UUID Tnukxc-udqo-z8bk-ztoq-w93k-pqui-haxkja


4. Capacity expansion of physical volume VG_NODE5
# Vgextend VG_NODE5/DEV/SDB5
Volume Group "VG_NODE5" successfully extended
[Root@node5 ~]# VGs
VG #PV #LV #SN Attr vsize vfree
VG_NODE5 2 5 0 wz--n-199.47g 132.09g


Expanding the logical volume Vg_node5-data, or/data partition, to 80G
[Root@node5 ~]# lvextend-l 80g/dev/mapper/vg_node5-data
Extending logical volume data to 80.00 GiB
Logical Volume data successfully resized


Re-read size
[Root@node5 ~]# Resize2fs/dev/mapper/vg_node5-data
RESIZE2FS 1.41.12 (17-may-2010)
Filesystem At/dev/mapper/vg_node5-data is mounted on/data; On-line resizing required
Old desc_blocks = 2, new_desc_blocks = 5
Performing an on-line resize of/dev/mapper/vg_node5-data to 20971520 (4k) blocks.
The filesystem on/dev/mapper/vg_node5-data is now 20971520 blocks long.


[Root@node5 ~]# DF-LH
Filesystem Size used Avail use% mounted on
/dev/mapper/vg_node5-root 20G 479M 18G 3%/
Tmpfs 935M 0 935M 0%/dev/shm
/DEV/SDA1 485M 39M 421M 9%/boot
/dev/mapper/vg_node5-data 79G 184M 75G 1%/data
/DEV/MAPPER/VG_NODE5-USR 9.7G 1.6G 7.6G 18%/usr
/dev/mapper/vg_node5-web 15G 165M 14G 2%/web

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.