#1. lsblk or fdisk to Figure out the device name for the new device
$ lsblk -lf $fdisk -l
---------------------------------------- ---------------------------------------------
sda 8:32 0 238.5G 0 disk Disk /dev/sda: 17.2 GB, 17179869184 bytes
├─sda1 8:33 0 499M 0 part /boot Disk identifier: 0x000299d1
└─sda2 8:34 0 238G 0 part / --------
sdb 8:48 0 1.8T 0 disk Disk /dev/sdb: 17.2 GB, 17179869184 bytes
---------------------------------------- Disk identifier: 0x00000000 //this is blank.
----------------------------------------------
2. partion the new disk:
$ cfdisk /dev/sdb
> New -> Primary -> Specify size in MB
> Write -> yes
> Quit
3. Format the new disk;
$ mkfs.ext4 -L onetonstorage /dev/sdb
4. create a directory the disk to be mounted;
$ mkdir /disk2 //just dir. name
5. find the UUID with $ blkid or $ lsblk -f:
$ blkid
/dev/sda5: UUID="180cab2a-300a-4e3d-8c8e-0e1df46b9bf7" TYPE="swap"
/dev/sda1: UUID="cd0c7b2c-bf50-4557-bc01-0048764a41d2" TYPE="ext4"
/dev/sdb1: UUID="359d90df-f17a-42f6-ab13-df13bf356de7" TYPE="ext4"
$ lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1 vfat FAT32 5352-AC6C 250.5M 50% /boot
└─sda2 ext4 ArchLinux cce03871-dc3b-4418-90f9-87ca427d4223 29.4G 87% /
sdb
└─sdb1 ext4 1.0 234d9f5b-bfbd-4f46-a37b-420ed6940690
6. Add the new disk to fstab to automatically mount it on boot
$ echo "UUID=359d90df-f17a-42f6-ab13-df13bf356de7 /disk2 ext4 errors=remount-ro 0 1" >> /etc/fstab
OR $ nano /etc/fstab
----------------------------------------------------------------------------------------------
# /dev/sda1 LABEL=ArchLinux
UUID=cce03871-dc3b-4418-90f9-87ca427d4223 / ext4 defaults,errors=remount-ro 0 1
# /dev/sdb1 LABEL=onetonstorage
UUID=234d9f5b-bfbd-4f46-a37b-420ed6940690 /mnt/data ext4 defaults,errors=remount-ro 0 2
--------------------------------------------------------------------------------------------------
7. Manually mount the disk (you can also reboot the machine and it will be automatically mounted)
$ mount -a // -a Mount all filesystems mentioned in fstab (except for those with noauto keyword).
OR $ mount /disk2 //disk2 is the directory created in step 4
8. Verify drive is mounted.
$ lsblk
-----------------------------------------------
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:32 0 238.5G 0 disk
├─sda1 8:33 0 499M 0 part /boot
└─sda2 8:34 0 238G 0 part /
sdb 8:48 0 1.8T 0 disk
└─sdb1 8:34 0 1.8T 0 part /mnt/data
---------------------------------------------
$ mount
-------------------------------------------------------------
/dev/sda1 on /boot type vfat (rw,relatime,errors=remount-ro)
/dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro)
/dev/sdb1 on /mnt/data type ext4 (rw,relatime,errors=remount-ro)
------------------------------------------------------------------
9. Extra // Set Permissions
The file system of a drive can be configured in many ways.
By default, a drive will have user and group ownership (group) set to “root”.
Let’s change this to grant the primary user, “adam” access to the entire drive.
$ chown -R adam:adam /mnt/data
This will change the user and group ownership as follows.
$ ls -al /mnt
drwxr-xr-x 1 root root 208 Nov 30 14:23 ..
drwxr-xr-x 12 adam adam 4096 Dec 7 19:05 data