FDISK doesn't show any partitions for a disk, trying to resize an LVM disk, running CentOS
It is possible to have an entire disk used as a LVM PV, simply by targetting the whole-disk device with pvcreate
instead of using a partition. For example, using pvcreate /dev/sdb
instead of pvcreate /dev/sdb1
.
The caveat is that such a disk is only recognizable to Linux, not to system firmware (whether BIOS or UEFI), so it probably won't be usable as a bootable system disk. (Details will depend on the exact firmware and bootloader used.)
Also, other operating systems will see the disk as "unformatted" and will be completely unaware that the disk actually contains data. If the disk is accidentally presented to another operating system, this may lead to data loss.
A volume group always has a simple name: only PVs and LVs have pathnames. Basically any block device that can be prepared with a pvcreate
can be a LVM PV. A LV has a name that can be expressed as either /dev/<VG name>/<LV name>
or /dev/mapper/<VG name>-<LV name>
. Both LV name forms can usually be used, but some distributions prefer one or the other form, particularly for disks involved in early phases of the boot procedure.
On virtualized environments, skipping the partitioning on data disks makes it simpler to extend virtual disks: you can tell the virtualization platform (e.g. VMware) to extend the virtual disk, then if necessary tell the kernel to re-detect the disk size with echo 1 > /sys/block/sdb/device/rescan
. (Whether this re-detection step is necessary or not depends on the virtualization platform and drivers used: if paravirtualized drivers are used, the host might communicate to the VM that the disk has been extended and so it might be detected automatically.)
After these steps you'll be able to use use pvresize /dev/sdb
(or whatever) to extend the PV, then the new unallocated capacity will be available in the volume group and can be put to use with lvextend
or lvcreate
commands as necessary. This removes one step from the storage extension procedure by omitting the need to deal with extending a partition or creating a new one.
The administrators of virtualization platforms may appreciate keeping the number of virtual disks in a given VM relatively small and having each virtual disk be a single, meaningful entity, e.g. "system disk", "all data for application 1", "all data for application 2", etc. In this sense, it might be considered better to extend an existing virtual disk when more capacity is needed than to add a new virtual disk.
Related videos on Youtube
saleetzo
Updated on September 18, 2022Comments
-
saleetzo almost 2 years
This particular system is acting peculiar and i've not seen this before. System is running CentOS and is a VM on VMWare. I increased the space on the drive from 100GB to 130GB. When I went in to the system, I can see the new space when runnning
fdisk
but, I dont see any partitions on /dev/sdb.Disk /dev/sdb: 139.6 GB, 139586437120 bytes 255 heads, 63 sectors/track, 16970 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/mapper/sys-swap: 1073 MB, 1073741824 bytes 255 heads, 63 sectors/track, 130 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/mapper/sys-root: 106.3 GB, 106266886144 bytes 255 heads, 63 sectors/track, 12919 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000
Running
fdisk
on that disk returns:Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0x8926c36c. 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): p Disk /dev/sdb: 139.6 GB, 139586437120 bytes 255 heads, 63 sectors/track, 16970 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x8926c36c Device Boot Start End Blocks Id System
There are no partitions listed there at all. Even if its VG, I still normally see
8e
as the type and some info on it. When I runvgdisplay
it also looks a little weird. Doesn't seem to give me the full path and just lists the VG as "sys".VG Name sys System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 12 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 1 Act PV 1 VG Size 99.97 GiB PE Size 32.00 MiB Total PE 3199 Alloc PE / Size 3199 / 99.97 GiB Free PE / Size 0 / 0 VG UUID E3jBIZ-BbxE-CnJg-IwBi-mXaP-xrN2-JbjXmY
Am I just missing or forgetting something and this is totally normal and I should just go through
fdisk
and create and new partition, runpvcreate
and extend it withvgextend
, etc?Thanks in advance for your time! I'm not sure if im missing something... just looks weird. Also, here is
mount
to see the drive types:/dev/mapper/sys-root on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0") /dev/sda1 on /boot type ext4 (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
-
Ipor Sircer over 6 yearstry
gdisk
instead of fdisk. -
saleetzo over 6 yearsJust tried and it looks like
gdisk
isn't showing any of the partitions either... -
saleetzo over 6 yearsim not sure why the partitions are not showing properly. I ended up creating a new disk on sdc and then added it in to the volgroup. Im not happy with the server having issues so im thinking about going to CodeCommit or something else. or just rebuilding.
-