# Linux Disk Drives

**URL:** https://discussion.scottibyte.com/t/linux-disk-drives/198
**Category:** Uncategorized
**Created:** [March 2, 2023, 1:12am UTC](https://discussion.scottibyte.com/t/linux-disk-drives/198 "2023-03-02T01:12:22Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![scott](https://discussion.scottibyte.com/letter_avatar_proxy/v4/letter/s/3e96dc/32.png) [@scott](https://discussion.scottibyte.com/u/scott)
#### Post date: [March 2, 2023, 1:12am UTC](https://discussion.scottibyte.com/t/linux-disk-drives/198/1 "2023-03-02T01:12:22Z")

</div>

Windows users and new Linux users are usually not aware of the steps to configure a new disk drive. Most disk drives are configured with Globally Unique Identifier (GUID) formatted partition tables which are required for booting via the Unified Extensible Firmware Interface (UEFI).

In this tutorial we will learn the steps necessary in preparing a new disk drive for use with Linux.

To view all of the block oriented devices on a Linux system.

```auto
lsblk

```

New disk drives which have not been used before have no partition table and an easy way to prepare a drive is to enter the “parted” utility. The following command assumes that your new and unused drive is “sdb”. The “lsblk” command will help you identify the drive name for your drive.

Be sure to identify the correct drive, because the following commands will destroy everything on the drive that you select.

```auto
sudo parted /dev/sdb

```

Create a GUID partition table on the new “sdb” drive:

```auto
mklabel gpt

```

My drive is 100GB in size, so I create a 100GB partition with a 1MB block size:

```auto
mkpart primary ext4 1MB 100GB

```

Quit the parted program:

```auto
quit

```

List the partitions on the new drive:

```auto
sudo fdisk -l /dev/sdb

```

In order to mount a partition, you will need a mount point. A mount point is a folder anywhere on the system. It is good practice to place mount point folders in /mnt:

```auto
sudo mkdir /mnt/mydrive

```

You can mount the drive for use on the system:

```auto
sudo mount -t auto /dev/sdb1 /mnt/mydrive

```

If you reboot, the drive will not continue to be mounted and you will need to mount it again.

To check to see the drive is mounted:

```auto
df

```

To dismount the drive:

```auto
sudo umount /dev/sdb1

```

To have the drive mounted when the system boots is often desirable. The first step in doing this is to find the UUID of the partition that you want to mount.

```auto
sudo blkid /dev/sdb1

```

Next edit the file systems table:

```auto
sudo nano /etc/fstab

```

Insert a line at the end of the fstab file indicating the UUID from the blkid command and the mount point as follows:

```auto
UUID=f486841f-aaf5-4cca-8fd3-3d6262b7ed08 /mnt/mydrive ext4 rw,exec 0 0

```

Save the file with a CTRL O followed by the enter key and a CTRL X to exit the nano editor.

Reboot your system:

```auto
sudo reboot now

```

When the system reboots, you should be able to see the drive is mounted with the following command:

```auto
df

```

To make accessing the drive easier, you can create a symbolic link in your home folder:

```auto
ln -s /mnt/mydrive

```

By default, mount points in /mnt are owned by the system. The assumption is that the system administrator will create folders owned by users.

In the tutorial I showed that if you change ownership of the mount point, you can own the entire drive.

```auto
sudo chown scott:scott /mnt/mydrive

```

You can delete the symbolic link we created above like you would delete any other file:

```auto
rm mydrive

```
