Friday, 25 October 2019

How to Write an fstab File on Linux

The platters inside multiple hard drives.
zentilia/Shutterstock.com

Adding a new hard drive or solid-state drive to your Linux computer? You’ll need to edit your fstab file. A lot of people find the very idea scary. Yes, it’s critical that you get it right, but armed with the right knowledge, it really isn’t difficult. We step you through the process of editing your fstab file to integrate your new drive into your file system.

fstab, the File Systems Table

Although adding a new hard drive to a Linux computer isn’t too complicated, it can be a little confusing the first time you try. You connect up the hardware, power on the computer, and log in to the operating system. But you cannot see your new drive anywhere. Why doesn’t it show up? How do you get Linux to “see” the drive so you can start to configure it?

Actually, Linux has seen your hardware, but it doesn’t readily announce it. Or even give you a hint that it has found your new hardware. You have to interrogate Linux to obtain the information you’re going to need to put into your fstab file.

Here’s how to set up your new hard drive so that Linux—and you—can see it and use it. There are two parts to the process. The first part is doing some reconnaissance to identify the hard drive and to gather some information on it. The second part is editing the fstab file, using the information we’ve gathered in the reconnaissance phase.

Finding Your New Drive

We’re adding two new drives to this system. One is a 32 GB mechanical hard drive (HD), and the other is a 16 GB solid-state drive (SSD).

We need to know that Linux can see them, and what block devices Linux is using for them. In Linux and Unix-like operating systems, a block device is a special file that acts as an interface to a device that data can be read from and written to (unless it is read-only). Block devices often represent a mass-storage unit of some kind (for example, a partition on a hard disk or a CD-ROM. They are created in the /dev directory.

We can use the lsblk command to list the block devices connected to your Linux computer.

lsblk

lsblk in a terminal window

The output from lsblk is in columns.

Read the remaining 89 paragraphs



from How-To Geek https://ift.tt/2BEpyvY

No comments:

Post a Comment