LINUX, FOSS AND LIBRARY TECHNOLOGY ENTHUSIAST

Wednesday, November 18, 2026

Preparing an External Hard Disk for Linux: Formatting with EXT4

0 comments
When using an external hard disk primarily with Linux systems, EXT4 is one of the most practical filesystem choices. It is mature, reliable, and widely supported across Ubuntu, Debian, Raspberry Pi OS and other Linux distributions.

Recently, I prepared a 1TB WD SATA hard disk for Linux use by replacing its existing NTFS filesystem with EXT4.

Here is a brief walkthrough of the process.

1. Identify the hard disk

First, connect the HDD and identify its device name using:

lsblk -o NAME,SIZE,MODEL,FSTYPE,LABEL,MOUNTPOINTS

In my case, the WD 1TB HDD appeared as /dev/sda, with an existing NTFS partition mounted at /media/mahesh/wd.

Important: Always verify the disk identity before formatting. Formatting the wrong device can result in permanent data loss.

2. Create a GPT partition table

After backing up the existing data and unmounting the NTFS partition, I created a new GPT partition table:

sudo umount /dev/sda2
sudo parted /dev/sda --script mklabel gpt

Next, I created a single partition occupying the entire disk:

sudo parted /dev/sda --script mkpart primary ext4 1MiB 100%

3. Format the partition with EXT4

The newly created partition was formatted using the EXT4 filesystem:

sudo mkfs.ext4 -L WD-STORAGE /dev/sda1

The -L option assigns a meaningful volume label, making the drive easier to identify.

4. Mount the HDD

I created a dedicated mount directory:

sudo mkdir -p /mnt/wd-storage

Then mounted the partition:

sudo mount /dev/sda1 /mnt/wd-storage

To allow my Ubuntu user to manage files on the drive:

sudo -R $USER:$USER /mnt/wd-storage
sudo chmod 755 /mnt/wd-storage

5. Configure automatic mounting

To ensure the HDD is mounted automatically whenever the system starts, I used its filesystem UUID rather than its device name.

First, retrieve the UUID:

sudo blkid /dev/sda1

Then edit /etc/fstab:

sudo nano /etc/fstab

Add the following entry, replacing the UUID with the actual value reported by your system:

UUID=xxxx-xxxx-xxxx /mnt/wd-storage ext4 defaults,nofail,x-systemd.device-timeout=10 0 2

Finally, test the configuration:

sudo mount -a

6. Verify the configuration

Two useful commands to verify the final setup are:

lsblk -f

df -h /mnt/wd-storage

These display the filesystem, volume label, UUID, mount point and available storage capacity.

Final configuration

Parameter Configuration
Hard Disk WD 1TB External HDD
Partition Scheme GPT
Filesystem EXT4
Volume Label WD-STORAGE
Partition /dev/sda1
Mount Point /mnt/wd-storage
Automatic Mounting /etc/fstab (UUID-based)
Ownership shec:shec
Permissions 755
Approximate Capacity 931 GiB

No comments:

Post a Comment