Initializing Hard Drive - Linux: Difference between revisions
(]) |
No edit summary |
||
(8 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
<pre>fdisk -l</pre> | <pre>fdisk -l</pre> | ||
For larger disks, make sure the partition table is gpt (vs mbr). This allows for larger and more partitions. To do this: | |||
<pre>Using GParted, you can do this by going into Device->Create Partition Table and select "gpt" from the list.</pre> | |||
Or parted | |||
<pre> | |||
sudo aptitude install parted | |||
parted /dev/sdb | |||
print | |||
mklabel gpt | |||
mkpart primary ext4 0% 100% | |||
</pre> | |||
Creating a File System | |||
<pre>sudo mkfs.ext4 -L media /dev/sdb1</pre> | |||
To view all disks and retrieve the disk UUID: | |||
<pre>lsblk --fs</pre> | |||
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> | |||
Note that the folder must exist before the mount command is run | |||
<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