increase a physical partion size

Latest response

Hello All,

thanks for your help with this.

I have a device /dev/sdb which has 1T of space. This space has been allocated to the first partition /dev/sdb1. It has an ext4 filesys and it is mount. This device /dev/sdb, has been increased to 1.5T. How do I grow /dev/sdb1 to 1.5T without loosing data?

Thank you all always.



i'd go:
1. parted (just type 'parted' and you get parted CLI, type '?' for hlp - there is 'resize' option, after you resized partition ->
2. resize2fs

i'd unmount it and run fsck just to make sure FS is clean and offline

I'd add a e2fsck on the mount before the resize2fs, resize2fs will often ask for this anyhow.

If possible, unmount the filesystem, this is usually cleaner than online resize.

For RHEL 5, resizing partitions and filesystems are documented in the Deployment Guide. For RHEL 6, check the Storage Administration Guide.

Thank you all for the information.

In general, if the disk has been offlined (all filesystems dismounted; any LVs using the PV deactivated, etc.), extending the partition-table to accommodate an increased LUN size is fairly trivial. You'll want to ensure you have a good backup just in case things go sideways.

  • Use sfdisk to save off the current partition table (this save-file can be used by sfdisk to restore the partition table if you want/need to revert).
  • Use fdisk or sfdisk to locate the current first block on disk - this will typically be 63 or 2048 depending on whether using EL-release prior to or post 6.x (respectively). If it's a value other than these defaults, it generally means the person who previously set up the disk used expert mode to change the starting block offset
  • Repartition the disk by doing parted -s /dev/<DEVNODE> -- mklable msdos|gpt primary <FSTYPE> 0G 100%. This will blow away the current partition table, replacing it with one that starts at the default offset and consumes 100% of the blocks on disk (if the prior setp showed an other-than-default starting block, you can/should change the "0G" to "s").
  • If the partition type was previously set to "LVM", youll want to do a parted -s /dev/<DEVNODE> -- set 1 volume on followed by a pvscan/lvscan/vgscan to have LVM see the new partition-size.
  • Grow the filesystem hosted on the partition/LV (see Matt's not on e2fsck)