For IP projects, as a dedicated server customer, you have the option of having additional hard disks installed in the servers. These hard drives can be used as backup hard drives or external system hard drives. The following tutorial deals with how to mount another hard disk in a running operating system as an additional data disk, for example to place backups on this hard disk.
1. Find out Hard Drive Device
Before you can format a hard drive and integrate it for use in the system, you must first find out the name of the new hard drive in the system. All system devices can be found in the folder /dev
SATA hard drives are recognized as sd in the /dev folder. The first hard disk in the server is therefore the hard disk sda - the other hard disks are then designated according to the ABC. The 2nd hard drive would therefore be the sdb hard drive, the third hard drive sdc, etc.
A 3Ware or Adaptec hardware RAID controller is displayed as a SATA hard drive. The individual hard drives on the hardware RAID controller are only visible via the operating system if they have been configured as individual devices on the controller.
A software RAID array is always called md under /dev. If the server was installed via our standard installer, /dev/md0 represents the boot partition in which the Linux kernel is located and /dev/md1 the data partition. With a software RAID, the disks can also be addressed individually under /dev/sda and /dev/sdb. This should be noted if you want to find out the correct hard drive you want to format.
The df command allows us to display the current partitions on the Linux shell:
root@s10:~# df Dateisystem 1K Blöcke Benutzt Verfügbar Ben% Eingehängt auf /dev/md1 43272312 32577240 8496908 80% / tmpfs 3969896 0 3969896 0% /lib/init/rw udev 3964864 180 3964684 1% /dev tmpfs 3969896 0 3969896 0% /dev/shm /dev/md0 960492 35724 875976 4% /boot
This example is a software RAID. The members in the software RAID array can be displayed with the command cat /proc/mdstat:
root@s10:~# cat /proc/mdstat Personalities : [raid1] md1 : active raid1 sda3[3] sdb3[2] 43963320 blocks super 1.2 [2/2] [UU] md0 : active raid1 sda1[3] sdb1[2] 975860 blocks super 1.2 [2/2] [UU] unused devices: <none>
The output on the Linux shell indicates that the software RAID members are /dev/sda and /dev/sdb. The hard disk, which should be mounted in addition to the server, should therefore have the name /dev/sdc.
Now that we have determined which disk is the new disk in Debian Linux, we can start formatting and mounting it in the operating system.
2. Format hard drive up to 2 TB storage capacity
Up to a hard disk capacity of 2 TB, you can conveniently partition the hard disk with the command
cfdisk
Just follow the menu and create a new partition with the total disk size.
Then format the disk using the command
mkfs.ext3 /dev/sdc1
Depending on which file system you want to use, you can of course also use mkfs.ext4 or similar file systems.
3. Format hard drive over 2 TB storage capacity
The usual partitioning table works on an old standard, at the time of development an 8 GB hard disk was the highest of the feelings. Therefore, a new partitioning option has been created for new hard disks, which are partitioned with the software GNU Parted.
With the command
parted /dev/sdc
start the software and assign a disklabel to the hard disk.
(parted) mklabel Neuer Disk-Label-Typ? Neuer Disk-Label-Typ? gpt Warnung: Die bestehende Partitionstabelle und alle Daten auf /dev/sdc werden gelöscht. Wollen Sie fortfahren? Ja/Yes/Nein/No? Ja
As a unit for the partition size we specify TB, which makes the later entries a bit easier.
(parted) unit TB
Now we can create the primary partition with the command:
(parted) mkpart primary 0.00TB 4.00TB
For smaller hard drives than 4 TB you can also enter 3.00TB or 2.50TB.
If the partition was created successfully, you can use the command
(parted) quit
return to the normal Linux shell.
Now the system partition is created and can be formatted equally.
mkfs.ext3 /dev/sdc1
4. Mount Disk in Debian Linux
The mount points for Debian/Ubuntu are fixed in the file /etc/fstab, in this file you just add the line:
/dev/sdc1 /sdc ext3 rw 0 0
ext4 replaces ext3 with ext4./dev/sdc1, which disk device should be mounted. The following /sdc to which folder it should be mounted. In order for fstab to mount the device afterwards, of course the folder /sdc must be present, which you create with the command:
mkdir /sdc
The mountpoint can of course also be available elsewhere on the hard disk, for example/home/sdc or /media/sdc, there are no binding regulations here. The mount table finally with the command
mount -a