rescan the disks.
# ls /sys/class/scsi_host
host0 host1 host10 host11 host12 host2 host3 host4 host5 host6 host7 host8 host9
[root@server ~]# echo '- - -' > /sys/class/scsi_host/host0/scan
[root@server ~]# echo '- - -' > /sys/class/scsi_host/host1/sc
# echo '- - -' > /sys/class/scsi_host/host12/scan
find the disk
# fdisk -l
# multipath -ll
create new partition
# fdisk /dev/mapper/mpatha
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xf3ced09e.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-261, default 3):
Using default value 3
Last cylinder, +cylinders or +size{K,M,G} (3-261, default 261):
Using default value 261
Command (m for help): p
Disk /dev/mapper/mpatha: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 16384 bytes / 16777216 bytes
Disk identifier: 0xf3ced09e
Device Boot Start End Blocks Id System
/dev/mapper/mpathap1 3 261 2080417+ 83 Linux
Partition 1 does not start on physical sector boundary.
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
create physical volume
# pvcreate /dev/mapper/mpathap1
physical volume "/dev/mapper/mpathap1" successfully created
create volume group
# vgcreate datavg /dev/mapper/mpathap1
volume group "datavg" successfully created
# vgdisplay -v datavg
using volume group(s) on command line.
--- Volume group ---
VG Name datavg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 1.96 GiB
PE Size 4.00 MiB
Total PE 503
Alloc PE / Size 0 / 0
Free PE / Size 503 / 1.96 GiB
VG UUID LLiW6z-8rhi-2cPj-LA0x-eW8A-HAMT-8TDdYS
--- Physical volumes ---
PV Name /dev/mapper/mpathap1
PV UUID AXBOp7-nnRs-cijS-oA4o-n4fV-8c2K-rH9V1h
PV Status allocatable
Total PE / Free PE 503 / 503
create logical volume
# lvcreate -l 503 -n lvdata datavg (lvcreate -l 100%free)
# vgdisplay -v datavg
Using volume group(s) on command line.
--- Volume group ---
VG Name datavg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 1.96 GiB
PE Size 4.00 MiB
Total PE 503
Alloc PE / Size 0 / 0
Free PE / Size 503 / 1.96 GiB
VG UUID LLiW6z-8rhi-2cPj-LA0x-eW8A-HAMT-8TDdYS
--- Logical volume ---
LV Path /dev/datavg/lvdata
LV Name lvdata
VG Name lvdata
LV UUID VaJaMw-arzU-PZDI-v9bn-TU54-BkOV-Cdn8Xc
LV Write Access read/write
LV Creation host, time Server, 2021-02-11 12:01:30 +0530
LV Status available
# open 0
LV Size 1.96 GiB
Current LE 503
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:12
--- Physical volumes ---
PV Name /dev/mapper/mpathap1
PV UUID AXBOp7-nnRs-cijS-oA4o-n4fV-8c2K-rH9V1h
PV Status allocatable
Total PE / Free PE 503 / 503
format the volume (ext4)
# mkfs.ext4 /dev/datavg/lvdata
create a mount point and mount
# mkdir /data01
# mount /dev/datavg/lvdata /data01