This guide explains how to partition, format, and permanently mount a new data disk at /data on CentOS 7, Ubuntu 24.04, and Debian 9. It also explains how to create drive D: for a new data disk in Disk Management on Windows Server 2019.
/dev/sdb and /dev/sdb1. Actual names may be /dev/vdb, /dev/xvdb, /dev/nvme1n1, etc. Always confirm the disk by its capacity and model before running commands. Never format a device just because its name matches the example.On CentOS 7 and Debian 9, switch to root:
su -
Ubuntu 24.04 normally uses sudo. If you are already root, remove sudo from the commands below.
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT,UUID,MODEL
sudo fdisk -l
Typically the system disk is /dev/sda and the new disk is /dev/sdb. Check capacity, model, existing partitions, and filesystem. Do not format the system disk.
CentOS 7:
yum install -y parted xfsprogs
Ubuntu 24.04:
sudo apt update
sudo apt install -y parted e2fsprogs
Debian 9:
apt-get update
apt-get install -y parted e2fsprogs
The example assumes the new disk is confirmed as /dev/sdb.
parted /dev/sdb --script mklabel gpt
parted /dev/sdb --script mkpart primary xfs 1MiB 100%
partprobe /dev/sdb
udevadm settle
lsblk /dev/sdb
mkfs.xfs /dev/sdb1
mkdir -p /data
blkid /dev/sdb1
Example output:
/dev/sdb1: UUID="11111111-2222-3333-4444-555555555555" TYPE="xfs"
cp -a /etc/fstab /etc/fstab.bak.$(date +%F-%H%M%S)
vi /etc/fstab
Add the following line at the end, replacing the example UUID:
UUID=11111111-2222-3333-4444-555555555555 /data xfs defaults,nofail 0 0
mount -a
findmnt /data
df -hT /data
The example assumes the new disk is /dev/sdb.
sudo parted /dev/sdb --script mklabel gpt
sudo parted /dev/sdb --script mkpart primary ext4 1MiB 100%
sudo partprobe /dev/sdb
sudo udevadm settle
lsblk /dev/sdb
sudo mkfs.ext4 -L data /dev/sdb1
sudo mkdir -p /data
sudo blkid /dev/sdb1
sudo cp -a /etc/fstab /etc/fstab.bak.$(date +%F-%H%M%S)
sudo nano /etc/fstab
Add this line with the real UUID:
UUID=11111111-2222-3333-4444-555555555555 /data ext4 defaults,nofail 0 2
sudo mount -a
findmnt /data
df -hT /data
Switch to root with su - and confirm the new disk is /dev/sdb.
parted /dev/sdb --script mklabel gpt
parted /dev/sdb --script mkpart primary ext4 1MiB 100%
partprobe /dev/sdb
udevadm settle
mkfs.ext4 -L data /dev/sdb1
mkdir -p /data
blkid /dev/sdb1
cp -a /etc/fstab /etc/fstab.bak.$(date +%F-%H%M%S)
vi /etc/fstab
Add:
UUID=11111111-2222-3333-4444-555555555555 /data ext4 defaults,nofail 0 2
mount -a
findmnt /data
df -hT /data
A new filesystem is normally owned by root. If an application account such as appuser needs write access:
chown appuser:appuser /data
chmod 750 /data
Avoid chmod 777 /data; it allows every local user to write to the directory.
Win + R.diskmgmt.msc and press Enter.Data.
diskpart
list disk
select disk N
detail disk
online disk
attributes disk clear readonly
convert gpt
create partition primary
format fs=ntfs quick label=Data
assign letter=D
list volume
exit
Replace N with the new disk number. Use detail disk to verify the disk before convert gpt. Skip that command if the disk is already GPT. Never run clean on a disk containing data.
/dev/nvme1n1p1.lsblk -f or blkid shows a filesystem and UUID, verify whether data exists./dev/sdb1.mount -a before rebooting; fix every error first.After mount -a succeeds and a maintenance window is available, reboot and verify:
reboot
findmnt /data
df -hT /data
ls -ld /data
Current system time:2026-08-13 14:48:49(UTC+8) Privacy PolicyRegistrants' Benefits And Responsibilities SpecificationsRegistrant Educational Information
Copyright© 2026 GNAME.COM. All rights reserved. Non-Public Registrant Data (NPRD) Disclosure