Possible to extend /DEV/SDB1 on Centos machine without downtime/data loss?

1

on CentOS6 I would like to extend /dev/sdb1 to get more free space:

df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_www-lv_root 18G 2.9G 14G 18% / tmpfs 3.9G 0 3.9G 0% /dev/shm /dev/sda1 477M 105M 347M 24% /boot /dev/sdb1 296G 233G 48G 84% /sqldata

The physical harddisk SDB has already been extended to 600GB in VMWare. Fdisk /dev/sdb1 as follows:

Disk /dev/sda: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 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: 0x000021cd

Device Boot Start End Blocks Id System /dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 64 2611 20458496 8e Linux LVM

Disk /dev/sdb: 644.2 GB, 644245094400 bytes 255 heads, 63 sectors/track, 78325 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: 0x07acc91f

Device Boot Start End Blocks Id System /dev/sdb1 1 39162 314568733+ 83 Linux /dev/sdb2 39163 78325 314576797+ 8e Linux LVM

Disk /dev/mapper/vg_www-lv_root: 18.9 GB, 18865979392 bytes 255 heads, 63 sectors/track, 2293 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/vg_www-lv_swap: 2080 MB, 2080374784 bytes 255 heads, 63 sectors/track, 252 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

As you can probably see, /dev/sdb1 is not part of a volume group. So i'm not sure how to proceed.

I already created a new partition: /dev/sdb2 as linux LVM: fdisk /dev/sdb

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: 644.2 GB, 644245094400 bytes 255 heads, 63 sectors/track, 78325 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: 0x07acc91f

Device Boot Start End Blocks Id System /dev/sdb1 1 39162 314568733+ 83 Linux /dev/sdb2 39163 78325 314576797+ 8e Linux LVM

/dev/sdb2 is a new (empty) partition containing the new 300gb of diskpace. As I cannot affort any downtime really I would like to know how to "merge" sdb1 and sdb2 so I end up with a /sqldata of approx 600gb.

Thanks!

linux
centos
hard-drive
fdisk
asked on Server Fault Jan 14, 2020 by Timon

1 Answer

0

Downtime is very likely required in this environment, a single partition.

EL6 docs warn you to not attempt a resize on a device in use. Stop everything using this file system, unmount it, and alter its partition table.

EL7 makes resizing partitions online possible, by deleting, re-creating, and the partx --update trick to tell the kernel. You would need to upgrade first, probably to EL8.


With LVM instead of partitions, this can be easier. Skip partitioning completely. Create physical volumes on entire devices, such as /dev/sdb. Resize the disk, then the PV using it with pvresize. As you are not using LVM, this would be a migration to new LVM storage.

answered on Server Fault Jan 15, 2020 by John Mahowald

User contributions licensed under CC BY-SA 3.0