Initializing Hard Drive - Linux: Difference between revisions

No edit summary
No edit summary
 
Line 24: Line 24:
Add the new drive to the fstab file to allow automatic mounting
Add the new drive to the fstab file to allow automatic mounting
<pre>UUID=3df346bc-48d9-4ac7-962a-ad7ead8654b7 /home/media    ext4  defaults    0  2</pre>
<pre>UUID=3df346bc-48d9-4ac7-962a-ad7ead8654b7 /home/media    ext4  defaults    0  2</pre>
Note that the folder must exist before the mount command is run


<pre>mount /home/media</pre>
<pre>mount /home/media</pre>

Latest revision as of 22:19, 29 November 2020

Use fdisk to identify new hard drive (use sudo or root)

fdisk -l

For larger disks, make sure the partition table is gpt (vs mbr). This allows for larger and more partitions. To do this:

Using GParted, you can do this by going into Device->Create Partition Table and select "gpt" from the list.

Or parted

sudo aptitude install parted
parted /dev/sdb
print
mklabel gpt
mkpart primary ext4 0% 100%

Creating a File System

sudo mkfs.ext4 -L media /dev/sdb1

To view all disks and retrieve the disk UUID:

lsblk --fs

Add the new drive to the fstab file to allow automatic mounting

UUID=3df346bc-48d9-4ac7-962a-ad7ead8654b7 /home/media     ext4  defaults    0  2

Note that the folder must exist before the mount command is run

mount /home/media