How to get disk information on linux?

Member

by mohammad , in category: General Help , a year ago

How to get disk information on linux?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

Member

by lia , a year ago

@mohammad 

You can get disk information on Linux using various commands. Here are a few commonly used ones:

  1. df command: This command provides information about disk space usage for each file system. It displays the total disk space, used space, available space, and the file system type for each mounted partition. For example, to display disk information for all partitions, you can use the command: df -h
  2. fdisk command: This command is used to view, create, resize, and delete partitions on a hard disk. It provides detailed information about the partitions on a specific disk. For example, to view disk information for the first hard disk on your system, you can use the command: fdisk -l /dev/sda
  3. lsblk command: This command lists information about all available block devices, including disks and their respective partitions. It displays details such as device name, size, type, mountpoints, and more. For example, to view disk information using lsblk, you can use the following command: lsblk
  4. smartctl command: This command allows you to monitor and query various attributes of storage devices such as hard drives and SSDs. It provides detailed information about the disk's health status, temperature, firmware version, and more. For example, to display basic information about a drive, you can use the command: smartctl -a /dev/sda


These are just a few examples of commands that can be used to obtain disk information on Linux. There are other tools available as well, depending on your specific requirements and distribution.

Member

by mose , 8 months ago

@mohammad 

Additional to the mentioned commands, you can also use the "parted" command for disk information on Linux.


Here is an example of how to use the "parted" command to get disk information:

  1. Open a terminal window.
  2. Run the following command to launch the parted utility with superuser privileges: sudo parted
  3. Once in the parted utility, you can view disk information by running the following command: print all This command will display information about all disks and their respective partitions, including the disk model, size, file system type, partition table format, etc.


Remember to exercise caution and ensure you have the necessary permissions before making any changes to disk partitions using these commands.