How to Expand an Unpartitioned Data Disk on CentOS 7.4
This guide demonstrates how to expand a data disk that lacks partitions on a CentOS 7.4 system, covering both ext* and XFS filesystems, using resize2fs and xfs_growfs commands, and verifying the expansion with df -TH.
When a data disk has no partitions and only a filesystem is created (or the disk is formatted), it can be mounted directly. # lsblk shows sdb has no partitions The example uses CentOS 7.4 64‑bit, where /dev/sdb originally 5 GB without partitions, later expanded to 10 GB in the console. The guide shows how to enlarge the filesystem to use the added space.
Extend ext* filesystem
Run resize2fs on the disk: resize2fs /dev/sdb
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 17G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 10G 0 disk /data
sr0 11:0 1 9.5G 0 rom
# resize2fs /dev/sdb
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/sdb is mounted on /data; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/sdb is now 2621440 blocks long.Check the result with df -TH :
# df -Th
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 475M 0 475M 0% /dev
tmpfs tmpfs 487M 0 487M 0% /dev/shm
tmpfs tmpfs 487M 7.7M 479M 2% /run
tmpfs tmpfs 487M 0 487M 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 17G 1.7G 16G 10% /
/dev/sda1 xfs 1014M 138M 877M 14% /boot
/dev/sdb ext4 9.8G 23M 9.3G 1% /data
tmpfs tmpfs 98M 0 98M 0% /run/user/0Extend XFS filesystem
Run xfs_growfs on the disk:
# xfs_growfs /dev/vdb
meta-data=/dev/vdb isize=512 agcount=4, agsize=655360 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, spinodes=0
data = bsize=4096 blocks=2621440, imaxpct=25
= sunit=0 swidth=0 blks
naming =version2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 2621440 to 15728640.Verify with df -TH :
# df -TH
Filesystem Type Size Used Avail Use% Mounted on
/dev/vdb xfs 60G 34M 60G 1% /mnt/sdcSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Linux
Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
