Frequently Asked Questions

New Data Disk Initialization and Persistent Mounting Guide

Updated Time:2026-08-12  Views:140

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.

Important warning: Partitioning and formatting can erase all existing data on the target disk. The examples use /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.

1. Common Linux preparation

1.1 Obtain administrator privileges

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.

1.2 Identify the new disk

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.

1.3 Install required tools

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

2. CentOS 7: permanently mount XFS at /data

The example assumes the new disk is confirmed as /dev/sdb.

2.1 Create a GPT partition table and partition

parted /dev/sdb --script mklabel gpt
parted /dev/sdb --script mkpart primary xfs 1MiB 100%
partprobe /dev/sdb
udevadm settle
lsblk /dev/sdb

2.2 Format the partition

mkfs.xfs /dev/sdb1

2.3 Create the mount point and obtain the UUID

mkdir -p /data
blkid /dev/sdb1

Example output:

/dev/sdb1: UUID="11111111-2222-3333-4444-555555555555" TYPE="xfs"

2.4 Configure persistent mounting

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

2.5 Test the mount

mount -a
findmnt /data
df -hT /data

3. Ubuntu 24.04: permanently mount EXT4 at /data

The example assumes the new disk is /dev/sdb.

3.1 Create a GPT partition table and partition

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

3.2 Format the partition

sudo mkfs.ext4 -L data /dev/sdb1

3.3 Create the mount point, get the UUID, and back up fstab

sudo mkdir -p /data
sudo blkid /dev/sdb1
sudo cp -a /etc/fstab /etc/fstab.bak.$(date +%F-%H%M%S)

3.4 Configure and test persistent mounting

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

4. Debian 9: permanently mount EXT4 at /data

Switch to root with su - and confirm the new disk is /dev/sdb.

4.1 Create the partition and format it

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

4.2 Configure persistent mounting

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

5. Linux directory permissions after mounting

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.

6. Windows Server 2019: create drive D: in Disk Management

6.1 Open Disk Management

  1. Sign in with an administrator account.
  2. Press Win + R.
  3. Enter diskmgmt.msc and press Enter.
  4. If the disk is missing, choose Action > Rescan Disks.

6.2 Initialize the disk

  1. Identify the new disk by capacity, for example “Disk 1”.
  2. If it is Offline, right-click the disk label and choose Online.
  3. Right-click the Unknown/Not Initialized area and choose Initialize Disk.
  4. Select GPT (GUID Partition Table) and click OK. GPT is recommended and supports disks larger than 2 TB.

6.3 Create a simple volume and assign D:

  1. Right-click the Unallocated area and choose New Simple Volume.
  2. Set the volume size; keep the default maximum to use the whole disk.
  3. Assign drive letter D.
  4. Choose NTFS, default allocation unit size, and optionally set the label to Data.
  5. For a new empty disk, select Perform a quick format, then click Finish.
  6. Verify the capacity and read/write access in File Explorer.
If D: is already in use: A DVD drive may already use D:. Change its drive letter to an unused letter (for example Z:) in Disk Management, then assign D: to the new volume. Changing a letter used by applications or services can break them.

6.4 Optional DiskPart method

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.

7. Important notes and troubleshooting

  • Back up first: Create a cloud snapshot or confirm a recoverable backup before modifying disks.
  • Device names vary: NVMe partitions commonly look like /dev/nvme1n1p1.
  • Do not format existing filesystems: If lsblk -f or blkid shows a filesystem and UUID, verify whether data exists.
  • Use UUID in fstab: It is more reliable than /dev/sdb1.
  • Test fstab: Run mount -a before rebooting; fix every error first.
  • About nofail: It lets the system continue booting if the data disk is temporarily unavailable, but dependent applications may still fail.
  • Existing files under /data: They are hidden while the filesystem is mounted, not deleted. Confirm the directory is empty or migrate data first.
  • SELinux: CentOS 7 services may require the correct SELinux context; do not disable SELinux as a shortcut.
  • End-of-life systems: CentOS 7 and Debian 9 are past regular support. Plan an upgrade; archived repositories may be required.
  • Cloud disks: If Linux or Windows cannot see the disk, confirm it is attached to the correct server in the cloud console, then rescan.

8. Verify after reboot

After mount -a succeeds and a maintenance window is available, reboot and verify:

reboot
findmnt /data
df -hT /data
ls -ld /data
Next Topic: No Topic

Current system time:2026-08-14 04:28:03(UTC+8) Privacy PolicyRegistrants' Benefits And Responsibilities SpecificationsRegistrant Educational Information

Copyright© 2026 GNAME.COM. All rights reserved. Non-Public Registrant Data (NPRD) Disclosure