هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
$ مستخدم عادي# بصلاحية root (أو مع sudo)
The quick answer
Step by step
- Find the new disk — check it is really empty:
lsblk -f
NAME FSTYPE FSVER LABEL UUID MOUNTPOINTS
sda
├─sda1 xfs 1d2c... /boot
└─sda2 LVM2_member ...
sdbsdb has no file system and no mount — that is the new one. Never format a disk that shows a file system you do not know.
- Create the file system (XFS on RHEL, ext4 is fine too):
(Use one of them.) For a disk you may want to split later, use LVM or a partition first.
- Write the fstab line with the UUID:
| Field | Example | Means |
|---|---|---|
| 1 device | UUID=3f1c… | Stable ID (blkid). |
| 2 mount point | /data | Must exist (mkdir). |
| 3 type | xfs | File system. |
| 4 options | defaults,nofail | nofail = boot continues if the disk is missing. |
| 5 dump | 0 | Not used. |
| 6 fsck order | 0 | 0 for XFS; 2 for ext4 data disks. |
Network shares: add _netdev (wait for the network), for example nfs1:/export /mnt/share nfs4 defaults,_netdev,nofail 0 0.
- Test before you reboot — this is the important step:
systemctl daemon-reload
findmnt --verify
mount -a
findmnt /data
TARGET SOURCE FSTYPE OPTIONS
/data /dev/sdb xfs rw,relatime,...findmnt --verify finds typos; mount -a mounts everything in fstab — an error here means the line is wrong (fix it now, not at the next boot).
- Rights for the app:
chown app:app /data
restorecon -Rv /dataCheck that it worked
Reboot in a maintenance window: the server comes up, df -h /data shows the disk, and the app can write to it.
Common problems
| Problem | Cause | Fix |
|---|---|---|
| Server boots into emergency mode | Wrong fstab line, or the disk is missing (no nofail). | Log in on the console, fix or comment the line, systemctl daemon-reload, reboot. |
mount: /data: mount point does not exist | Folder not created. | mkdir -p /data. |
| Mounted the wrong disk after a reboot | /dev/sdX names changed. | Use UUID= (or LABEL=). |
wrong fs type, bad option, bad superblock | Wrong type or no file system on it. | lsblk -f; correct field 3 or create the file system. |
| NFS line hangs the boot | Network not ready. | _netdev,nofail (or autofs / a systemd automount). |
App gets Permission denied on /data | Owner root, or SELinux label. | chown; restorecon -Rv /data (or a proper semanage fcontext). |
Go further
- Command pages: mount, findmnt, blkid, lsblk.
- Next how-tos: Extend an LVM volume, Add swap space, Check disk space, Share a folder with NFS, Mount a Samba share, Partition and format a new disk.
- Learn it: RHCSA — UUID, RHCSA — fstab, RH134 — fstab, RH134 — Repair a bad fstab at boot.
- Network storage: NFS, Samba.
- Practise: Lab: partitions, file systems, swap and fstab, Lab: NFS server, fstab and autofs.
1Why use UUID= instead of /dev/sdb in fstab?
Device names can change between boots; the UUID stays the same.
2How do you test an fstab line without rebooting?
findmnt --verify and mount -a.