How to Detect and Format an Unrecognized Hard Disk in Linux (RHEL 6)


4 views

When dealing with unrecognized storage in Linux, the first step is verifying physical detection. Try these diagnostic commands:


# Check for all block devices
lsblk

# Alternative method using sysfs
ls /sys/block/

# Detailed hardware listing (requires root)
sudo lshw -class disk -class storage

If standard tools don't show the disk, try lower-level approaches:


# Scan for new SCSI devices
echo "- - -" > /sys/class/scsi_host/host0/scan
echo "- - -" > /sys/class/scsi_host/host1/scan

# Check kernel messages for disk events
dmesg | grep -i 'sd\|hd'

# View partition tables (even on unformatted disks)
sudo fdisk -l

Once identified (e.g., as /dev/sdb), proceed with formatting:


# Create new partition table (GPT recommended for >2TB)
sudo parted /dev/sdb mklabel gpt

# Create primary partition
sudo parted /dev/sdb mkpart primary ext4 0% 100%

# Format with ext4 filesystem
sudo mkfs.ext4 /dev/sdb1

# For XFS filesystem (common in RHEL)
sudo mkfs.xfs /dev/sdb1

For RHEL 6 persistent mounting:


# Create mount point
sudo mkdir /mnt/bigstorage

# Add to /etc/fstab
echo "/dev/sdb1 /mnt/bigstorage ext4 defaults 0 2" | sudo tee -a /etc/fstab

# Mount all filesystems
sudo mount -a

# Verify mount
df -h /mnt/bigstorage

If the disk remains undetected:

  • Check physical connections and power
  • Verify disk visibility in BIOS/UEFI
  • Test with live CD/USB to rule out OS issues
  • Inspect kernel module loading: lsmod | grep sd_mod

When dealing with storage devices that don't appear in standard Linux disk listing commands, we need to approach the problem methodically. Here's how to thoroughly investigate:

# Check all block devices regardless of mounting status
lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL

# View raw disk information from kernel
sudo cat /proc/partitions

# Alternative low-level device scanning
sudo lsscsi -g

# Check kernel messages for disk detection
dmesg | grep -i 'sd\|hd\|storage'

If standard tools don't reveal the disk, try these approaches:

# Rescan SCSI/SATA buses (for hot-plugged drives)
echo "- - -" | sudo tee /sys/class/scsi_host/host*/scan

# Check for LVM volumes that might be hiding the disk
sudo pvdisplay
sudo vgdisplay
sudo lvdisplay

# Examine udev device database
sudo udevadm info --export-db | less

Once you've identified the disk (e.g., /dev/sdb), proceed with preparation:

# Create new partition table (GPT recommended for >2TB)
sudo parted /dev/sdb mklabel gpt

# Create primary partition using entire disk
sudo parted -a opt /dev/sdb mkpart primary ext4 0% 100%

# Format with filesystem (adjust as needed)
sudo mkfs.ext4 -L "bigstorage" /dev/sdb1

# Verify filesystem creation
sudo blkid /dev/sdb1

For persistent mounting in Red Hat Enterprise Linux 6:

# Create mount point
sudo mkdir -p /mnt/bigstorage

# Add to /etc/fstab (using UUID is more reliable)
echo "UUID=$(sudo blkid -s UUID -o value /dev/sdb1) /mnt/bigstorage ext4 defaults 0 2" | sudo tee -a /etc/fstab

# Test mount configuration
sudo mount -a
df -h /mnt/bigstorage

If the disk still doesn't appear, consider these possibilities:

  • Check physical connections and power supply
  • Verify disk health with SMART tools: sudo smartctl -a /dev/sdb
  • Inspect RAID controller configuration if present
  • Test the disk on another system to confirm functionality