Blog

Add 3T HDD in a backup server

By C February 14, 2017

Hello,

The scope of this post is to show you how to add a new large disk to a sistem and mount it to a disrectory for use on backup servers in this example.
First things first, you need to add your new disk to a server 🙂

The situation will look something like that:

[root@backup1 ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/sda1 9.8G 1.3G 8.0G 14% /

tmpfs 938M 0 938M 0% /dev/shm

/dev/sda3 2.7T 1.5T 1.1T 58% /backup1

[root@backup1 ~]# fdisk -l

WARNING: GPT (GUID Partition Table) detected on ‘/dev/sda’! The util fdisk doesn’t support GPT. Use GNU Parted.

Disk /dev/sda: 3000.6 GB, 3000592982016 bytes

255 heads, 63 sectors/track, 364801 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 4096 bytes

I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk identifier: 0x00000000

Device Boot Start End Blocks Id System

/dev/sda1 1 267350 2147483647+ ee GPT

Partition 1 does not start on physical sector boundary.

Disk /dev/sdb: 3000.6 GB, 3000592982016 bytes

255 heads, 63 sectors/track, 364801 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 4096 bytes

I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk identifier: 0x00000000

As you can see the sdb disk is unpatitioned and unusable at this point.

The scope is to make it available under /backup2/ directory.

We will use “parted” to manage this new disk. If is not installed on your system do so:

[root@backup1 ~]# yum install parted

Loaded plugins: fastestmirror

Setting up Install Process

Loading mirror speeds from cached hostfile

* base: mirrors.uav.ro

* extras: mirrors.uav.ro

* updates: mirrors.uav.ro

Resolving Dependencies

–> Running transaction check

—> Package parted.x86_64 0:2.1-25.el6 will be installed

–> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================

Package Arch Version Repository Size

========================================================================================================================================

Installing:

parted x86_64 2.1-25.el6 base 607 k

Transaction Summary

========================================================================================================================================

Install 1 Package(s)

Total download size: 607 k

Installed size: 2.2 M

Is this ok [y/N]: y

Downloading Packages:

parted-2.1-25.el6.x86_64.rpm | 607 kB 00:00

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : parted-2.1-25.el6.x86_64 1/1

Verifying : parted-2.1-25.el6.x86_64 1/1

Installed:

parted.x86_64 0:2.1-25.el6

Complete!

Now we start making our way with sdb…

Start parted and select sdb:

[root@backup1 ~]# parted

GNU Parted 2.1

Using /dev/sda

Welcome to GNU Parted! Type ‘help’ to view a list of commands.

(parted) select

New device? [/dev/sda]? /dev/sdb

Using /dev/sdb

Verify that the select is correct:

(parted) print

Model: ATA ST3000DM001-1ER1 (scsi)

Disk /dev/sdb: 3.00TB

Sector size (logical/physical): 512B/4096B

Partition Table: loop

Number Start End Size File system Flags

And now let’s do the partition:

(parted) unit TB

(parted) mklabel gpt

Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost.

Do you want to continue?

Yes/No? y

(parted) mkpart primary 0.00TB 3.00TB

(parted) print

Model: ATA ST3000DM001-1ER1 (scsi)

Disk /dev/sdb: 3.00TB

Sector size (logical/physical): 512B/4096B

Partition Table: gpt

Number Start End Size File system Name Flags

1 0.00TB 3.00TB 3.00TB primary

(parted) quit

Information: You may need to update /etc/fstab.

As the notification say, you need to check/edit /etc/fstab file.

As you can see, the partition is not available just yet:

[root@backup1 ~]# less /etc/fstab

#

# /etc/fstab

# Created by anaconda on Wed Jan 28 12:30:37 2015

#

# Accessible filesystems, by reference, are maintained under ‘/dev/disk’

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

#

UUID=26461415-bb96-4ebb-bda3-26bd6db113ad / ext4 defaults 1 1

UUID=5578ee8f-910c-432e-a294-2eaa5665cf07 /backup1 ext4 defaults 1 2

UUID=49b8fc11-6839-475d-b124-69c9a0444f9a swap swap defaults 0 0

tmpfs /dev/shm tmpfs defaults 0 0

devpts /dev/pts devpts gid=5,mode=620 0 0

sysfs /sys sysfs defaults 0 0

proc /proc proc defaults 0 0

Format disk in ext4 :

mkfs.ext4 /dev/sdb1

Now we need to create the directory in wich we will use our new disk, and mount the disk there:

[root@backup1 ~]# mkdir /backup2

[root@backup1 ~]# mount /dev/sdb1 -t ext4 /backup2/

As you can see, we have available to use the space from sdb (new disk), but that’s not a permanent situation… yet…

[root@backup1 ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/sda1 9.8G 1.3G 8.0G 14% /

tmpfs 938M 0 938M 0% /dev/shm

/dev/sda3 2.7T 1.5T 1.1T 58% /backup1

/dev/sdb1 2.7T 73M 2.6T 1% /backup2

And now let’s make it permanent! We need to find out the UUID of new created partition and adding that to fstab will make the changes permanent:

[root@backup1 ~]# ls -l /dev/disk/by-uuid/

total 0

lrwxrwxrwx 1 root root 10 Feb 25 14:59 26461415-bb96-4ebb-bda3-26bd6db113ad -> ../../sda1

lrwxrwxrwx 1 root root 10 Feb 25 14:59 49b8fc11-6839-475d-b124-69c9a0444f9a -> ../../sda2

lrwxrwxrwx 1 root root 10 Feb 25 14:59 5578ee8f-910c-432e-a294-2eaa5665cf07 -> ../../sda3

lrwxrwxrwx 1 root root 10 Feb 25 15:35 cc0cedeb-2c08-43b1-b8c6-82966026569e -> ../../sdb1

[root@backup1 ~]# vi /etc/fstab

#

# /etc/fstab

# Created by anaconda on Wed Jan 28 12:30:37 2015

#

# Accessible filesystems, by reference, are maintained under ‘/dev/disk’

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

#

UUID=26461415-bb96-4ebb-bda3-26bd6db113ad / ext4 defaults 1 1

UUID=5578ee8f-910c-432e-a294-2eaa5665cf07 /backup1 ext4 defaults 1 2

UUID=cc0cedeb-2c08-43b1-b8c6-82966026569e /backup2 ext4 defaults 1 2

UUID=49b8fc11-6839-475d-b124-69c9a0444f9a swap swap defaults 0 0

tmpfs /dev/shm tmpfs defaults 0 0

devpts /dev/pts devpts gid=5,mode=620 0 0

sysfs /sys sysfs defaults 0 0

proc /proc proc defaults 0 0

I highlighted the line you have to create (with the UUID listed previous) in order to make this changes permanent.

The ultimate verification of you doings is to reboot the server. If everything is fine you should see the new disk mounted as seen before. After “my” reboot, the disks look like this:

[root@backup1 ~]# fdisk -l

WARNING: GPT (GUID Partition Table) detected on ‘/dev/sda’! The util fdisk doesn’t support GPT. Use GNU Parted.

Disk /dev/sda: 3000.6 GB, 3000592982016 bytes

255 heads, 63 sectors/track, 364801 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 4096 bytes

I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk identifier: 0x00000000

Device Boot Start End Blocks Id System

/dev/sda1 1 267350 2147483647+ ee GPT

Partition 1 does not start on physical sector boundary.

WARNING: GPT (GUID Partition Table) detected on ‘/dev/sdb’! The util fdisk doesn’t support GPT. Use GNU Parted.

Disk /dev/sdb: 3000.6 GB, 3000592982016 bytes

255 heads, 63 sectors/track, 364801 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 4096 bytes

I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk identifier: 0x00000000

Device Boot Start End Blocks Id System

/dev/sdb1 1 267350 2147483647+ ee GPT

Partition 1 does not start on physical sector boundary.

[root@backup1 ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/sda1 9.8G 1.3G 8.0G 14% /

tmpfs 938M 0 938M 0% /dev/shm

/dev/sda3 2.7T 1.5T 1.1T 58% /backup1

/dev/sdb1 2.7T 73M 2.6T 1% /backup2

Regards,

C. 

Facebooktwitterredditpinterestlinkedinmail

Leave a Reply

Your email address will not be published. Required fields are marked *

You're not a robot ! *