You have just added new storage to your Oracle Linux 8.10 server, but the disk sits idle—unformatted, unpartitioned, and inaccessible to your applications. Adding a new disk is only half the battle; the real work comes in preparing it for use.
Disk partitioning, formatting, and mounting are fundamental operations that every system administrator must master. If you get them wrong, you risk data loss, system instability, or failed backups. If you get them right, you will have reliable, scalable storage infrastructure.
This guide walks you through every step of the process: identifying new disks, creating partitions, formatting with the appropriate filesystem, creating mount points, and ensuring mounts persist across system reboots. Whether you are adding storage for databases, backups, or application data, this step-by-step approach ensures you do it correctly.
By the end of this guide, you will have new storage ready for production use—properly partitioned, formatted, mounted, and persistent.
Table of Contents
- Pre-requisites and Safety Precautions
- Understanding Disks, Partitions, and Filesystems
- Identify New Disk Devices
- Create Disk Partitions with fdisk
- Format Partitions with Filesystem
- Create Mount Points
- Mount Partitions
- Make Mounts Permanent with fstab
- Verify Mounts and Permissions
- Common Partitioning Issues
- Next Steps
Pre-requisites and Safety Precautions
CRITICAL WARNING: Disk partitioning is a destructive operation. Mistakes can result in permanent data loss. Always:
- Back up all critical data before proceeding
- Verify you are working on the CORRECT disk
- Never partition or format
/dev/sdaunless you intentionally want to recreate your system disk - Test these steps in a lab environment first if possible
System Requirements:
- Oracle Linux 8.10 (fully updated)
- Root or sudo access
- At least one unformatted disk or free space
- Basic Linux command knowledge
Pre-operation Verification:
# Verify your current user has sudo access
sudo whoami
# Check existing disks and mounts
lsblk
# View disk usage
df -h
# Document your existing setup before making changes
lsblk > /tmp/disk-before.txt
df -h > /tmp/df-before.txt
Store these files safely. If something goes wrong, they serve as reference points.
Understanding Disks, Partitions, and Filesystems
Before touching any disk, you should understand the three foundational concepts:
Disks: Physical storage devices. On Linux, these are identified as /dev/sda, /dev/sdb, and so on. The first disk is usually your system disk; additional disks are for data.
Partitions: Logical divisions within a disk. A single disk can have multiple partitions, each treated as a separate storage unit. For example, /dev/sdb1, /dev/sdb2, etc.
Filesystems: The data structure that organizes how files are stored. Common options include:
- ext4 (traditional, reliable, mature)
- XFS (high performance, better for large files, Oracle's recommendation)
- Btrfs (advanced features, snapshots, but less mature)
For Oracle Linux 8.10, XFS is recommended for production workloads due to superior performance and scalability.
Identify New Disk Devices
The first step is identifying which disk is new and unallocated.
Step 1: List All Disks
#List block devices (disks and partitions)
lsblk
#Alternative: show disk names and sizes
sudo fdisk -l
Example output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 99G 0 part /
sdb 8:16 0 500G 0 disk ← NEW DISK (no partitions)
The new disk (sdb in this example) shows no partitions. This is the disk we will work with.
Step 2: Verify the New Disk
#Get detailed information about the new disk
sudo fdisk -l /dev/sdb
#Check if disk is formatted
sudo file -s /dev/sdb
Expected output for an unformatted disk: data (not a filesystem)
Step 3: Identify Disk Size
#Show disk in human-readable format
lsblk -h /dev/sdb
#Or use parted
sudo parted -l /dev/sdb
Now you know which disk to work with and its size. Critical: Ensure this is the correct disk before proceeding.
Create Disk Partitions with fdisk
Now create a partition on the new disk. We will use fdisk, the standard partitioning tool.
Step 1: Launch fdisk on the New Disk
#Start fdisk (interactive tool)
sudo fdisk /dev/sdb
#You will see the fdisk prompt: Command (m for help):
Step 2: Create a New Partition
At the Command prompt, type the following commands in order:
#Type 'n' to create a new partition
n
#Type 'p' for primary partition (we will create one partition using the entire disk)
p
#Partition number: press Enter (accepts default, usually 1)
#First sector: press Enter (accepts default, 2048)
#Last sector: press Enter (accepts entire disk)
#Confirm partition creation
#"Created a new partition 1 of type 'Linux' and of size 500 GiB."
Step 3: Write Partition Table and Exit
#Type 'w' to write the partition table to disk
w
#You will see: "The partition table has been altered."
#fdisk exits automatically
Step 4: Verify Partition Creation
#Verify the new partition exists
lsblk /dev/sdb
#Detailed information
sudo fdisk -l /dev/sdb
Expected output:
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 1048575999 1048573952 500G 83 Linux
Format Partitions with Filesystem
The partition exists but is empty (no filesystem). We must format it with a filesystem. For Oracle Linux 8.10, we will use XFS (Oracle's recommended filesystem).
DANGER: This step is destructive. The partition is about to be erased. If you have any doubt about the partition, stop and verify with lsblk.
Step 1: Format with XFS Filesystem
#Format /dev/sdb1 with XFS
sudo mkfs.xfs /dev/sdb1
#You will see output like:
#"meta-data=/dev/sdb1 isize=512 agcount=15, agsize=16711680 blks"
#"data = bsize=4096 blocks=250643968, imaxpct=25"
#"naming =version 2 bsize=4096 ascii-ci=0 ftype=1"
#"log =internal log bsize=4096 blocks=122368, version=2"
#"realtime =none extsz=4096 blocks=0, rextents=0"
Step 2: Verify Filesystem Creation
#Check filesystem type
sudo file -s /dev/sdb1
#You should see: "XFS filesystem data"
#Alternative verification
sudo xfs_info /dev/sdb1
The partition is now formatted and ready to be mounted.
Create Mount Points
A mount point is a directory where the filesystem will be accessible. You must create the directory before mounting.
Step 1: Choose Mount Point Location
Standard locations for data storage:
/data- General application data/backup- Backup storage/var/lib/mysql- MySQL data/opt/app- Application-specific storage
For this guide, we will use /data.
Step 2: Create the Mount Point Directory
#Create mount point (use sudo as it is in root directory)
sudo mkdir -p /data
#Verify creation
ls -ld /data
#Expected output: drwxr-xr-x. 2 root root 6 Dec 19 10:45 /data
Step 3: Set Appropriate Permissions
#Change ownership (for MySQL, use mysql:mysql)
sudo chown mysql:mysql /data
#Set permissions (755 = rwxr-xr-x)
sudo chmod 755 /data
#Verify permissions
ls -ld /data
#Expected output: drwxr-xr-x. 2 mysql mysql ...
Mount Partitions
Step 1: Manual Mount (Temporary)
#Mount the partition
sudo mount /dev/sdb1 /data
#Verify the mount
mount | grep /data
#Check disk usage
df -h /data
#Expected output:
#Filesystem Size Used Avail Use% Mounted on
#/dev/sdb1 500G 1.4G 499G 1% /data
Step 2: Verify Data Accessibility
#Create a test file to verify write permissions
sudo touch /data/test-file.txt
#List contents
ls -la /data/
#Remove test file
sudo rm /data/test-file.txt
The partition is now mounted and ready for use. However, this mount will disappear after reboot. Continue to the next section to make it permanent.
Make Mounts Permanent with fstab
Step 1: Get Partition UUID
#Get the UUID of the partition
sudo blkid /dev/sdb1
#Expected output:
#/dev/sdb1: UUID="a1b2c3d4-e5f6-4g7h-8i9j-0k1l2m3n4o5p" TYPE="xfs"
#Copy the UUID (you will need it in the next step)
Step 2: Edit /etc/fstab
#Create a backup of fstab (CRITICAL)
sudo cp /etc/fstab /etc/fstab.bak
#Edit fstab
sudo nano /etc/fstab
#Or use vi
sudo vi /etc/fstab
Step 3: Add Mount Entry to fstab
Add this line at the end of the file (replace UUID with your actual UUID):
UUID=a1b2c3d4-e5f6-4g7h-8i9j-0k1l2m3n4o5p /data xfs defaults,nofail 0 2
Explanation of each field:
UUID=...- Unique identifier for the partition/data- Mount pointxfs- Filesystem typedefaults,nofail- Options (nofail = do not fail boot if disk unavailable)0- Dump frequency (0 = never backup with dump)2- fsck order (2 = check after root filesystem)
Step 4: Verify fstab Syntax
#Test the fstab file for syntax errors
sudo mount -a
#If no errors appear, the entry is correct
#If errors appear, edit the file again
Step 5: Unmount and Remount (Verify Permanent Mount)
#Unmount the partition
sudo umount /data
#Verify it is unmounted
df -h /data
#Should show an error or not list /data
#Remount using fstab entry
sudo mount -a
#Verify mount is active
mount | grep /data
df -h /data
If the remount succeeds, the fstab entry is correct and will persist across reboots.
Verify Mounts and Permissions
Before putting the disk into production, verify everything is correct.
Step 1: Check All Mounts
#Show all mounted filesystems
mount | grep xfs
#Show disk space usage
df -h /data
#Show inode usage
df -i /data
#Expected output for 500GB disk:
#Filesystem Inodes IUsed IFree IUse% Mounted on
#/dev/sdb1 2097152 12 2097140 1% /data
Step 2: Verify Permissions
#Check mount point ownership
ls -ld /data
#Verify correct user/group can access
sudo -u mysql touch /data/mysql-test.txt
#Clean up test file
sudo rm /data/mysql-test.txt
Step 3: Check Filesystem Health
# Display XFS filesystem information
sudo xfs_info /data
#Check for filesystem issues (read-only, does not modify disk)
sudo xfs_metadump /dev/sdb1 | head -20
Step 4: Test Reboot Persistence
#Reboot the system
sudo reboot
#After reboot, verify mount is still active
df -h /data
#Check fstab entry is active
mount | grep /data
#Verify permissions are correct
ls -ld /data
If /data still shows mounted after reboot, the permanent mount is working correctly.
Common Partitioning Issues
Issue 1: Wrong Disk Formatted
#There's no recovery. Data is gone. Prevent this by:
#1. Always verify with lsblk BEFORE formatting
#2. Double-check device name (/dev/sdb vs /dev/sda)
#3. Use fdisk -l to list all disks first
Issue 2: fstab Entry Causes Boot Failure
#If you added a bad fstab entry and the system won't boot:
#1. Boot into single-user/rescue mode
#2. Edit /etc/fstab and remove the problematic line
#3. Reboot
#Prevent this by:
#1. Always backup /etc/fstab before editing
#2. Test with 'sudo mount -a' before rebooting
# Boot from rescue mode and restore backup
sudo cp /etc/fstab.bak /etc/fstab
Issue 3: Mount Point Shows "Permission Denied"
#Check ownership and permissions
ls -ld /data
#Fix permissions (example for MySQL)
sudo chown mysql:mysql /data
sudo chmod 755 /data
#Verify access
sudo -u mysql ls /data
Issue 4: "Device or Resource Busy" When Unmounting
#A process is using the mount point
#Find processes using the mount
sudo lsof +D /data
#Stop the process or wait for it to finish
#Then unmount
sudo umount /data
Issue 5: UUID Not Found in blkid Output
#Old disks may not have UUIDs
#Use device name in fstab instead
#Example:
/dev/sdb1 /data xfs defaults,nofail 0 2
#However, UUIDs are more reliable (survive device renaming)
#Try creating UUID if missing:
sudo xfs_admin -U generate /dev/sdb1
sudo blkid /dev/sdb1
When NOT to Use This Approach
This guide covers standard single-partition configurations. If your scenario involves:
- Logical Volume Management (LVM): Multiple partitions combined into logical volumes. See Oracle Linux LVM Administration Guide
- RAID Arrays: Redundant disk configurations. Consult RAID Configuration on Oracle Linux
- Encrypted Filesystems: LUKS encryption for sensitive data. See LUKS Encryption on Oracle Linux
- Network Storage (NFS/iSCSI): Remote storage mounting. Refer to NFS Configuration on Oracle Linux
For these advanced configurations, consult specific guides.
Next Steps
Your disk is now formatted, partitioned, mounted, and persistent. Here is what to do next:
Immediate Actions:
- Backup fstab: Ensure
/etc/fstab.bakis stored safely - Document Configuration: Save
lsblk,df -h, and/etc/fstabfor reference - Monitor Disk Space: Set up alerts for disk usage thresholds
External Resources:
- Oracle Linux Admin Guide - Storage - Official storage administration
- XFS Project Documentation - Filesystem technical details
- fdisk Man Page - Complete fdisk reference
- fstab Man Page - fstab format specification
Conclusion
You've successfully partitioned a new disk, formatted it with XFS, created a mount point, mounted it, and made that mount persistent across reboots—the complete disk preparation workflow on Oracle Linux 8.10.
By following this guide, you've:
- Identified and verified the new disk
- Created a partition using fdisk
- Formatted with the enterprise-grade XFS filesystem
- Created appropriate mount points and directories
- Mounted the partition manually and via fstab
- Verified ownership, permissions, and persistence
This foundation is critical for production environments. Whether you're preparing storage for databases, backups, or application data, proper disk management ensures reliability and performance.
The next step: Deploy your application or database to this storage and monitor performance and usage.
Always remember the core principle: verify, verify, verify before executing destructive disk operations. Backups and documentation save careers.