Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
$ als gewone gebruiker# als root (of met sudo)
The quick answer
Step by step
- Find the new disk (line 1) — it has the expected size, no partitions, no file system and no mount point. Compare with the cloud console (size, LUN). On NVMe systems the name is like
/dev/nvme1n1and partitions arenvme1n1p1. When in doubt,ls -l /dev/disk/by-id/. - Partition table and one partition (line 2) — GPT works for any size; starting at 1 MiB keeps the partition aligned. For a disk that will only hold one file system you may also format the whole disk without a partition, but a partition makes its use clear to others.
- File system (line 3) — XFS is the RHEL default and good for big data; ext4 (
mkfs.ext4 -L data /dev/sdb1) can also shrink later. The label helps humans; the UUID is what fstab uses. - Mount point and fstab (lines 4–5) — the UUID stays the same when device names change (
sdbcan becomesdcafter a reboot).nofaillets the server boot even if this disk is missing. - Test the fstab line now (line 6) —
mount -amounts everything in fstab. An error here would also stop the next boot, so fix it before you reboot. - Rights — the new file system belongs to root; give the app its folder:
chown app:app /data. On SELinux systems set the right context for the app's data (semanage fcontext+restorecon). - Consider LVM — if the data will grow, create an LVM volume instead of a plain partition, so you can add disks later.
Check that it worked
findmnt /data shows /dev/sdb1 with type xfs; df -h /data shows the full size; after a reboot (systemctl reboot) /data is mounted again.
Common problems
| Problem | Cause | Fix |
|---|---|---|
mkfs says the device contains a file system | Wrong disk, or a disk used before. | Stop and check lsblk -f; only wipe (wipefs -a) when you are sure. |
| New partition not visible | Kernel did not re-read the table. | partprobe /dev/sdb or udevadm settle. |
| Server stops at boot in emergency mode | fstab error or missing disk without nofail. | Fix the line from the emergency shell; add nofail; test with mount -a. |
mount: wrong fs type | fstab type differs from blkid output. | Use the type blkid shows. |
| Disk name changed after reboot | /dev/sdX order is not stable. | Mount by UUID or label. |
App gets Permission denied | Folder owned by root, or wrong SELinux label. | chown; restorecon -Rv /data with a proper fcontext rule. |
Go further
- Command pages: parted, lsblk, mkfs.xfs, blkid, findmnt.
- Next how-tos: Mount a disk at boot with fstab, Extend an LVM volume and its file system, Grow an XFS file system online, Repair a file system after a crash.
- Learn it: RHCSA — parted, RHCSA — Make file systems, RHCSA — fstab, RH134 — Partitions with parted.
1Why mount by UUID and not by /dev/sdb1?
Device names can change between boots; the UUID belongs to the file system and stays the same.
2Why run mount -a after editing fstab?
It tests the new line at once; an error would otherwise only show at the next boot and could stop it.