Step‑by‑Step Guide to Mount a New Disk on Linux
This tutorial walks through checking existing partitions, creating a new partition on /dev/sdb, formatting it with XFS, mounting it temporarily, and configuring /etc/fstab for automatic mounting after reboot, providing all necessary commands and screenshots.
1. Check existing disk partitions
Use fdisk -l or lsblk to list current disks. In the example, /dev/sdb shows no partitions.
2. Create a new partition on the disk
Run fdisk /dev/sdb and follow the interactive prompts to create a primary partition (e.g., /dev/sdb1).
3. Format the new partition
Format the partition with the XFS filesystem using:
mkfs.xfs /dev/sdb14. Verify the filesystem type
Run blkid to list all block devices and their filesystem types, confirming the new XFS partition.
5. Mount the partition temporarily
Mount it to a chosen directory (e.g., /ynat/) with:
mount /dev/sdb1 /ynat/Note: This mount is temporary and will disappear after a reboot.
6. Configure automatic mounting at boot
First obtain the partition UUID with blkid. Then edit /etc/fstab (using vi or another editor) and add a line similar to:
UUID=your‑partition‑uuid /ynat xfs defaults 0 0Make sure each field is separated by spaces.
7. Reboot and verify
Reboot the system with reboot. After the system starts, run df -h to confirm that the partition is mounted at the target directory.
If the mount is missing, revisit step 6 to ensure the /etc/fstab entry is correct.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
