Need to mount an additional hard drive or disk partition on Linux? Here’s what you need to know about the disks and mount commands.
What Is Mounting?
In most cases, mounting refers to the process which enables your computer to access files stored on different devices, such as USB drives or hard disk drives. Each drive has its own separate file system or systems that need to be integrated into your PC’s ecosystem. Most Linux distributions do a lot of mounting because they’re composed of multiple file systems in the form of “partitions.”
Under SSH, run below command to see your current hard drive partitions:
df -h
examples:
/dev/sda1 20G 4.7G 15G 24% / tmpfs 245M 0 245M 0% /dev/shm /usr/tmpDSK 485M 11M 449M 3% /tmp
and then Run
fdisk -l
the output:
Disk /dev/sda: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sda1 * 1 2550 20480000 83 Linux /dev/sda2 2550 2611 490496 82 Linux swap / Solaris Disk /dev/sdb: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x2038f030 Device Boot Start End Blocks Id System /dev/sdb1 1 1305 10482381 83 Linux
to mount properly, you have to partition the harddrive first.
fdisk /dev/sdb n p 1 press enter twice wq
and then format the hard drive
mkfs.ext3 /dev/sdb1
and mount it as a backup drive:
mount /dev/sdb1 /backup/
auto load this harddrive when server restarts:
echo "/dev/sdb1 /backup/ ext3 defaults 0 0" >> /etc/fstab
and done
In your WHM/Cpanel, you should see output like this:
/dev/sdb1 /backup 2% (154,232 of 10,317,828) /dev/sda1 / 24% (4,852,624 of 20,469,760) /tmp /var/tmp 2% (10,576 of 495,844) /usr/tmpDSK /tmp 2% (10,576 of 495,844)