Log into SSH on your dedicated or cloud server.

Finding out device name and size of disk you going to work with, run the fdisk –l command.

# fdisk –l

The sample output below shows /dev/sdb have about 3TB.

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 / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sdb doesn’t contain a valid partition table

Now we going to partition it with parted with command below.

# parted /dev/sdb

The output is listed below.

Creates a new GPT disklabel i.e. partition table:
(parted) mklabel gpt

Sample outputs:
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? yes
(parted)

Next, set the default unit to TB, enter:

(parted) unit TB

To create a 3TB partition size, enter:
(parted) mkpart primary 0 0

To print the current partitions, enter:
(parted) print
Sample outputs:
Model: ATA ST33000651AS (scsi)
Disk /dev/sdb: 3.00TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 0.00TB 3.00TB 3.00TB ext4 primary
Quit and save the changes, enter:
(parted) quit

Sample outputs:
Information: You may need to update /etc/fstab.
Use the mkfs.ext3 or mkfs.ext4 command to format the file system, enter:
# mkfs.ext3 /dev/sdb1
OR
# mkfs.ext4 /dev/sdb1
Type the following commands to mount /dev/sdb1, enter:
# mkdir /data
# mount /dev/sdb1 /data
# df -H

Sample outputs:
Filesystem Size Used Avail Use% Mounted on
/dev/sdc1 16G 819M 14G 6% /
tmpfs 1.6G 0 1.6G 0% /lib/init/rw
udev 1.6G 123k 1.6G 1% /dev
tmpfs 1.6G 0 1.6G 0% /dev/shm
/dev/sdb1 3.0T 211M 2.9T 1% /data

Leave a Reply

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