Adding a Second Hard Drive to Linux Machine

31 December 2023 - 4TB SSD Hard Drive on NUC 13 Pro Kit running Rocky Linux 9.3

19 April 2016 - 3TB Hard Drive on CentOS 6

See Installing 3TB Hard Drive on Debian


Follow the instructions on this page. But if you are using SATA drives, replace "hdb" with "sdb" and "hdb1" with "sdb1", etc.

http://www.yolinux.com/TUTORIALS/LinuxTutorialAdditionalHardDrive.html

For newer hardware, see http://go2linux.garron.me/linux/2010/09/uuid-linux-fstab-file-766 for UUID information.

Mounting a hard drive with UUID in /etc/fstab


4 July 2015 Notes

Backup any important files

vi /etc/fstab to remove old HDD entry first Remove/replace drive. Boot.

Use rescue mode if you forgot to undo /etc/fstab RHEL6 rescue mode:

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-System_Recovery.html#sec-Rescue_Mode

vi /etc/fstab to remove old HDD entry.

Reboot, get this prompt:

SELinux relabeling required.

Note, each * is 1000 files that have been relabeled

http://www.linuxforums.org/forum/red-hat-fedora-linux/161383-solved-boot-failure-after-latest-kernel-update-fed-12-a.html

Relabeling took 18 minutes on a 250MB primary drive 87% full. Not sure how many files it had.

Partition the new drive:

http://www.techotopia.com/index.php/Adding_a_New_Disk_Drive_to_an_RHEL_6_System

[root@localhost: /dev/disk]# fdisk /dev/sdf

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): c
DOS Compatibility flag is not set

Command (m for help): u
Changing display/entry units to sectors

Command (m for help): p

Disk /dev/sdf: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x0000f111

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 
Value out of range.
Partition number (1-4): 1
First sector (2048-3907029167, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-3907029167, default 3907029167): 
Using default value 3907029167

Command (m for help): p

Disk /dev/sdf: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x0000f111

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1            2048  3907029167  1953513560   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost: /dev/disk]# 

Format the new drive:

Update /etc/fstab with drive UUID in /dev/disk/by-uuid

mount -a

Reboot as final test.