How to perform basic administration tasks for Storage Devices in Linux?
Last updated
Last updated
Linux offers a wide variety of tools for managing storage. However, only a small number are utilised for regular administration and upkeep. You will learn about some of the most popular tools for managing storage devices, mount points and file systems in this tutorial.
There are certain prerequisites that need to be met before you begin.
Ubuntu 20.04 or any other Linux OS.
Non-root sudo user privilege.
Knowledge of basic linux commands.
The capacity and current utilization of the connected storage devices are frequently the most crucial details you need to know about your system's storage. Use the df utility to determine the overall amount of storage space that is available as well as the drives' current utilization. This normally outputs the data in 1K block format, which isn't always helpful. To print in readable human units, add the -h flag:
The other listings/entries (tmpfs, devtmpfs) make use of the tmpfs or devtmpfs filesystems, which are temporary memory systems that are treated like permanent storage. Entering the following will remove these results:
This output provides a more concentrated view of current disc utilization by removing some pseudo-devices and special devices.
Block Device: A storage device that receives or writes in blocks of a certain size is referred to as a "block device" in general. Almost all non-volatile storage devices, such as hard disc drives (HDDs), solid state drives (SSDs), and others, fall under this term. The filesystem is physically stored on a device called a block device. How data and files are kept is determined by the filesystem.
Information about block devices can be viewed using the lsblk tool. In general, the lsblk command can be used to show information about the drive itself, as well as the partitioning information and the filesystem that has been written to it. The exact capabilities of the utility rely on the version that is installed.
Without sudo, lsblk will show device names, major and minor device numbers (used by the Linux kernel to monitor drivers and devices).
The NAME, which corresponds to the name of the device under /dev, the SIZE, the TYPE, and the MOUNTPOINT are typically the most important elements of the output.
You can use the --fs flag on some versions to retrieve information more pertinent to managing discs and partitions:
Note: If your system does not support the --fs flag, you can manually duplicate the output by specifying a specific output with the -o flag. To obtain the same information, use the command line option -o NAME, FSTYPE, LABEL, UUID, MOUNTPOINT.
To learn more about the disc topology, type:
You might engage in mounting more regularly. The filesystem is made accessible to the server at the chosen mount point by mounting it. A directory under which the new filesystem can be accessed is referred to as a mount point.
Mount and Umount are the two complementing commands that are typically used to control mounting.
Mount: The mount command is used to include a filesystem in the currently selected file tree. No matter how many physical devices make up a Linux system, the system as a whole uses a single uniform file structure.
Umount: A filesystem can be unmounted with the umount command (note: this is umount, not unmount). The findmnt command can also be used to learn more about the state of mounted filesystems at the moment.
1. Using the mount Command:
The easiest way to use mount is to supply a formatted disc or partition together with the mount point to which it should be attached:
The last parameter, known as the mount point, should almost always be an empty directory because it determines where in the file hierarchy the new filesystem should be connected.
You can use the -a option to mount every filesystem listed in the /etc/fstab file:
2. Listing Filesystem Mount Options
Use the findmnt command to view the options used for a particular mount. For instance, if you used findmnt to inspect the read-only mount from the previous example, it would appear something like this:
3. Unmounting a Filesystem
You can unmount a specific filesystem with the umount command. The command's default form is to name the mount point or device of a presently mounted filesystem.
Note: Ensure that no files on the mount point are used and that no programs, including your active shell, are running inside the mount point:
The majority of the tools you require for routine system administration duties should be covered by this list. You can manage the storage devices on your server by becoming familiar with a few basic linux tools.