Trending March 2024 # List Device Names, Disk And Partition Information In Linux With Lsblk # Suggested April 2024 # Top 10 Popular

You are reading the article List Device Names, Disk And Partition Information In Linux With Lsblk updated in March 2024 on the website We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested April 2024 List Device Names, Disk And Partition Information In Linux With Lsblk

On Linux, you sometimes need to work with disks and/or partitions directly from the command line. Often, you actually want to perform actions on the filesystems, but you do so by specifying the partitions where they are stored. On the command line, you refer to these by using their device names (for example, “/dev/sda3”).

On systems with many disks, partitions, optical drives, and USB drives, it can be hard to identify the device name assigned to each of them.

What Does the lsblk Command Do?

lsblk displays information about storage devices. The utility is most often used to identify the correct device name to be passed to a subsequent command.

Most of the time, lsblk without any additional parameter, suffices to help identify the disk or partition you want to work with. From the picture above, for example, I can tell that “sda4” is a Windows partition, but that’s because I know its size is approximately 200GB. However, if you have two or more partitions of the same size, things may get more confusing. In other cases you may simply not know or remember the size of a particular disk or partition on your system.

On Linux, it’s dangerous to confuse device names, as you may destroy or corrupt useful data with a wrong command.

Useful lsblk Parameters

By default, lsblk displays just a few properties, as you saw in the picture above. But, if you add parameters to the command, you can make it output additional device properties. This, in turn, makes it much easier to identify the disk or partition you are looking for.

Find Out If It’s an SSD or Hard-Disk (HDD)

To see what extra columns lsblk can display, enter the following:



In this scenario you will use ROTA and DISC-GRAN. ROTA tells you if a block device belongs to a rotational storage device. Hard disks are rotational, so the column outputs “1” besides them (binary logical value meaning “true”). DISC-GRAN shows you the discard granularity. SSDs support discard to free up unused data blocks. Hard disks do not support this feature, since they don’t need it, so this column will display a zero value for them (“0B,” meaning discard granularity of zero bytes).

Show Filesystems Stored on Disks/Partitions

When you see a list of partitions, you might be able to tell what each of them stores, based on their sizes alone. When this is not enough, you can make lsblk output filesystems, too. It’s much easier to identify partitions this way because:

Windows uses the NTFS filesystem

Linux usually uses ext4

A USB device uses FAT, FAT32 (vfat) or NTFS

The EFI boot partition is usually very small and shows a vfat filesystem on it

Also, add the LABEL output column, which can help if partitions have been labeled when created/formatted.



+FSTYPE,LABEL Show Removable Devices/USB Memory Sticks lsblk



will display an extra column that tells you if the device is removable. A “1” value means “true,” which indicates a USB stick or other types of removable media.

Show HDD/SSD Model

This is useful when you want to look up the exact code of your storage device model to upgrade your firmware or download drivers.




+MODEL Show Filesystem UUID (Universally Unique Identifier)

Older Linux distributions mounted filesystems by specifying their device names in “/etc/fstab.” However, that proved unreliable since “/dev/sda2” might become “/dev/sdb2” when you add another storage device to the system. Nowadays, UUIDs are used instead, which remain constant no matter what you add/remove to/from your computer. For whatever reason you need UUIDs, you can make lsblk display them with



+UUID Show Other lsblk Columns You Need

At the beginning of the tutorial, you used



to see extra columns that lsblk can display. If the examples here are not sufficient for your needs, consult that help information again and combine parameters as needed. To do so, just enter lsblk -o +, followed by the column names that you want to output. Separate column names with a comma (“,”). For example:




After you identify the device name you want to work with, remember to replace it with the full device path in the subsequent command you intend to use. For example, if you got “sda4” as a result in lsblk, you will have to replace it with “/dev/sda4” in the next command. So, instead of “sda4” you type “/dev/sda4” in a command like mkfs -t ext4 /dev/sda4.

Alexandru Andrei

Fell in love with computers when he was four years old. 27 years later, the passion is still burning, fueling constant learning. Spends most of his time in terminal windows and SSH sessions, managing Linux desktops and servers.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.

By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time.

You're reading List Device Names, Disk And Partition Information In Linux With Lsblk

Manage Disk Partitions Like A Pro With These Disk Partition Software

1. Paragon Partition Manager 16

One of the most popular and well known partition management applications out there, Paragon Partition Manager is fully loaded with an impressive number of features. From moving/re-sizing partitions to changing volume labels, and from deleting partitions to converting file systems, Paragon Partition Manager can do everything.

Not just that, Paragon Partition Manager also has the ability to covert an HFS drive into NTFS (and vice-versa) without having to format the drive. All in all, Paragon Partition Manager is a comprehensive partition management solution, and Paragon has now made it a part of the Paragon Hard Disk Manager for Windows. The software is available for free with a limited feature set, and the paid version is available for $49.95 (but if you go for 5+ licenses, it’ll cost you $39.95 per license instead).

Platform Availability: Windows 10, 8, 7, Vista, and XP.

Price: Paid versions start from $39.95, Free version with limited features available.


2. Acronis Disk Director 12

It’s near impossible to talk about partition management software without mentioning Acronis Disk Director, and for good reasons. Boasting a truckload of powerhouse features, it’s an extremely potent software application that makes partition management a cakewalk.

Whether it’s standard disk management operations (moving, re-sizing, merging etc.), or other related tasks (e.g. defragmentation, volume editing), Acronis Disk Director can handle just about everything you throw at it. Other than that, you can use it to map multiple hard disks, recover damaged volumes, and effortlessly convert between partitioning schemes like MBR and GPT. In addition, Acronis Disk Director’s cloning feature lets you have all your favourite programs and settings up and running on a new disk (partition) in moments. You can also preview changes before committing them, and even create bootable media with this thing.

Moreover, Acronis Disk Director supports all the widely used formats, including FAT16, FAT32, NTFS, Ext2, Ext3, Linux SWAP, and ReiserFS3. Plus, the latest version, Acronis Disk Director 12 is fully compatible with both BIOS and UEFI based hardware, and is compatible with all versions of Windows up to Windows 10.

Go for Acronis Disk Director if you’re looking for a robust partition manager application that also offers some handy extras like cloning features. That being said, it’s important to note that it’s expensive as compared to the competition, and the free trial only lets you work with partitions up to 100 MB.

Price: Paid version costs $49.99, Also available as a feature restricted, unlimited length trial.


3. MiniTool Partition Wizard

Platform Availability: Windows 10, 8, 7, Vista, and XP.

Price: Paid versions start from $39.00, Free version available.


4. AOMEI Partition Assistant

On the hunt for a solid and well designed partition management software application? Look no further than AOMEI Partition Assistant. When it comes to easy partition management, it ticks off all the right boxes.

The software comes in multiple versions, including a free version which offers most of the features you’d expect in a disk partition management software. However, it misses out on features such as the ability to allocate free space from one partition to another, partition alignment, quick partitioning, and command line support. For those features you’ll have to buy the pro version.

Bottomline is, use AOMEI Partition Assistant if you want a fully featured, yet easy to use disk partition management tool. Also, it’s worth noting that its server versions are extremely capable, and perfect for IT administrators.

Price: Paid versions start from $39.95, Free version available.


5. Macrorit Disk Partition Expert

When using it for the first time, it’s easy to dismiss Macrorit Disk Partition Expert as yet another partition manager application. And even though that’s not exactly wrong, there are reasons why it’s worth considering.

Plus, if you’re wondering, Macrorit does offer all the features you’d expect from a disk partition management software. Apart from the usual features that I’ve mentioned above, the software brings the ability to convert MBR to GPT, or to convert NTFS to FAT32 without losing any data. You can also resize FAT partitions with Macrorit, and even change cluster sizes with ease. It also supports hard disks larger than 2TB in capacity, and fully supports all the usual sector sizes including 512 byte, 1K, 2K, and 4K. Along with that, there are a lot of other features too that you can check out from the Macrorit features page.

If you want a lightweight partition manager software that’s also specifically portable, Macrorit Disk Partition Expert is what you need. Then there’s also the fact that the starting price for its paid versions is less than other applications.

Platform Availability: Windows 10, 8, 7, Vista, and XP.

Price: Paid versions start from $39.99, Free version available.

See Also: How to Check Hard Disk Health in Windows

Manage those disk partitions better

How To Find A List Of Block Devices Information

lsblk command is used to display a list of information about all available block devices. However, it does not give a list of information about RAM disks. Examples of block devices are hard disk, flash drives, CD-ROM. This article explains about how to find a list of block devices in Linux Machine.

To install lsblk for Fedora and CentOS ,use the following command –

$ sudo yum install util-linux-ng

To install lsblk for Ubuntu and Linux Mint ,use the following command –

$ sudo apt-get install util-linux -y

To find the default list of all blocks, use the following command –

$ lsblk

The sample output should be like this –

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 931.5G 0 disk ├─sda1                               8:1 0 500M 0 part /boot/efi ├─sda2                               8:2 0 40M 0 part ├─sda3                               8:3 0 128M 0 part ├─sda4                               8:4 0 750M 0 part ├─sda5                               8:5 0 462.1G 0 part ├─sda6                               8:6 0 452.1G 0 part / ├─sda7                               8:7 0 8G 0 part │ └─vol_grp1-logical_vol1 (dm-0)     252:0 0 100M 0 lvm └─sda8                               8:8 0 7.9G 0 part [SWAP] sr0

The clear information about the above result is shown below –

NAME − It indicates the device name.

MAJ:MIN − It gives the major and minor device number information.

RM − This column shows whether the device is removable or not.

SIZE − This gives information on the size of the device.

RO − It indicates whether a device is read-only.

TYPE −This column shows information whether the block device is a disk or a partition(part) within a disk.

MOUNTPOINT − This column indicates mount point on which the device is mounted.

To show a list of all devices including empty devices, use the following command –

$ lsblk -a

The sample output should be like this –

sda 8:0 0 931.5G 0 disk ├─sda1                              8:1   0  500M    0 part /boot/efi ├─sda2                              8:2   0  40M     0 part ├─sda3                              8:3   0  128M    0 part ├─sda4                              8:4   0  750M    0 part ├─sda5                              8:5   0  462.1G  0 part ├─sda6                              8:6   0  452.1G  0 part / ├─sda7                              8:7   0  8G      0 part │ └─vol_grp1-logical_vol1 (dm-0)   252:0  0  100M    0 lvm └─sda8                              8:8   0  7.9G    0 part [SWAP] sr0                                 11:0  1  1024M   0 rom ram0                                1:0   0  64M     0 disk ram1                                1:1   0  64M     0 disk ram2                                1:2   0  64M     0 disk ram3                                1:3   0  64M     0 disk ram4                                1:4   0  64M     0 disk ram5                                1:5   0  64M     0 disk ram6                                1:6   0  64M     0 disk ram7                                1:7   0  64M     0 disk ram8                                1:8   0  64M     0 disk ram9                                1:9   0  64M     0 disk loop0                               7:0   0          0 loop loop1                               7:1   0          0 loop loop2                               7:2   0          0 loop loop3                               7:3   0          0 loop loop4                               7:4   0          0 loop loop5                               7:5   0          0 loop loop6                               7:6   0          0 loop loop7                               7:7   0          0 loop ram10                               1:10  0  64M 0 disk ram11                               1:11  0  64M 0 disk ram12                               1:12  0  64M 0 disk ram13                               1:13  0  64M 0 disk ram14                               1:14  0  64M 0 disk ram15                               1:15  0  64M 0 disk

To display information related to the owner, group and mode of the block device, use the following command –

$ lsblk -m

The sample output should be like this –

NAME                              SIZE     OWNER   GROUP MODE sr0

To find the size of columns in bytes, use the following command –

$ lsblk -b

The sample output should be like this –

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda                               8:0 0 1000204886016 0 disk ├─sda1                           8:1 0 524288000 0 part /boot/efi ├─sda2                          8:2 0 41943040 0 part ├─sda3                            8:3 0 134217728 0 part ├─sda4                            8:4 0 786432000 0 part ├─sda5                            8:5 0 496196648960 0 part ├─sda6                            8:6 0 485453987840 0 part / ├─sda7                            8:7 0 8576000000 0 part │ └─vol_grp1-logical_vol1 (dm-0)  252:0 0 104857600 0 lvm └─sda8                            8:8 0 8489271296 0 part [SWAP] sr0

If you do not want to display slave related information, use the following command –

$ lsblk -d

The sample output should be like this –

NAME   MAJ:MIN   RM   SIZE     RO  TYPE MOUNTPOINT sda    8:0       0     931.5G   0  disk sr0    11:0      1     1024M    0 rom

Congratulations! Now, you know “How to find a list of block devices information ”. We’ll learn more about these types of commands in our next Linux post. Keep reading!

Understanding Linux Disk Structure And Why It Doesn’T Need Defragmentation

Fragmentation Vs. Defragmentation

We’ve all heard of defragmentation. But first, what is fragmentation of data? To explain this concept, one of the best example you can find is the one used by Roberto Di Cosmo in a conference of 1998:

Your hard drive (or any other storing device) is like a shelf divided in boxes. All the boxes are of the same size and you use the shelf to store folders and files. When the shelf is empty, it is easy to put a folder in a box. If the folder is too large to fit in one box, you divide it and store the excess in the box next to it. You can do that as long as you have enough space left. However, when you are dealing with data on a computer, especially the one used by programs, the size varies a lot. Some files get bigger, deleted or moved. So really quickly, your shelf becomes a mess. Some boxes are half-empty, others cannot contain a growing folder. There are no free boxes at the bottom of the shelf (you started at the top) but you still need to store a new folder. Therefore you search for some free spaces in the previous boxes. In the end, your folder is divided and stored with some other parts of folders. You can imagine how difficult it is going to be in order to fetch the entire file in the shelf. Even if you wrote down where you stored the different parts, you still have to search in different boxes to gather all the files.

You can now imagine the pain of your computer searching for a file when the disk is really fragmented. Compared to your processor’s speed, the time needed by your hard drive to find a fragmented folder is a little eternity. So in order to stop the sufferings and the delays, we use the defragmentation process. It basically does what it sounds like: takes everything out and try to put all the folders back in order, getting rid of the wasted spaces and storing the divided parts back next to each other.

Why it does not concern Linux

Linux does not face the problem of the shelf. At least not to that extent. This is due to type of file system created specially for Linux: ext4. Ext4, like other file systems, manages the data and the space on a hard drive, but also does its best to prevent fragmentation. Going back to the shelf concept, when you store a folder into a box, ext4 will automatically book the neighboring boxes. It tries to anticipate the folder expansion, and actually does it quite well. That way, no folders will be divided and the shelf will remain ordered.

The downside is that the method requires a lot of free space. If there are no boxes left in the shelf, ext4 will have no choice but to go back to the old method of filling the holes. This can happen if you have less than 20% of free space left on your hard drive. So in general, your hard drive is not fragmented, or if it is, it is frequently less than 3% of its size.


Image credit: Storage by BigStockPhoto


Adrien is a young but passionate Linux aficionado. Command line, encryption, obscure distributions… you name it, he tried it. Always improving his system, he encountered multiple tricks and hacks and is ready to share them. Best things in the world? Math, computers and peanut butter!

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.

By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time.

List Of Operators In Kotlin With Their Examples

Introduction to Kotlin Operators

The following article outlines the most commonly used operators in Kotlin. Operators are special symbols used to perform specific operations on the operands. For example, the (-) operator performs a subtraction between two operands.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others


Operators in Kotlin, Here 67 and 7 are operands, and – is an operator.

Types of Kotlin Operators

Given below are the different types:

1. Arithmetic Operators

Arithmetic Operators perform basic arithmetic calculations like subtraction, addition, multiplication, division, etc. In Kotlin, simple a + b is interpreted as as a function call.

Operator Meaning Example

+ Add two operands a + b

– Subtract the right operand from the left operand a – b

* Multiply two operands a * b

/ Divide the left operand by the right one a / b

% Modulus – returns remainder on dividing two numbers a % b (deprecated from v 1.1)


package com.examples { var num1 = 64 var num2 = 32 val answer : double answer = num1 +num2 println ("sum = $answer")  answer = num1 - num2 println ("diff = $answer")     answer =num1 * num2 println ("mult = $answer")  answer = num1 / num2 println ("div = $answer")  answer = num1 % num2 println ("mod = $answer")  }

Note: The + operator is also used for String concatenation with strings.


package com.examples { val fname = "Laxman" val lname = "das" val full_name = fname + " " + lname println (full_name)          } 2. Assignment Operators

Assignment Operator is used to assign values to variables. The value after evaluation on the left-hand side is assigned to the right-hand side variable.

Besides the basic = assignment operator, Kotlin provides a wide range of assignment Operators, which are mentioned below:

Operator Example Equivalent to

+ = a+=b a=a+b

-= a-=b a=a-b

*= a*=b a=a*b

/= a/=b a=a/b

%= a%=b a=a%b


package com.examples { var number1 = 22 var number2 = 20 number1 + = 10 number2 % = 3 println ("Result1 = $number1")    } 3. Unary Operators

Unary Operators are those that work only on a single operand. Increment ( ++ ) and Decrement ( — ) operators are shortcuts of x = x+1 and x = x – 1

Operators Example Equivalent to

+ +a + (a value)

– -a –  (a value)

! !a Not a (inversion)

++ ++a a=a+1

— –a a=a-1


package com.examples { var a = 5 var b = 10 var c = 15 negation = -a increment = ++b dec = c-- println ("Negation = $negation")      }

In the above example, the value of b is first incremented by 1 and then assigned to variable’ increment,’ whereas the value of c is first assigned to variable dec and then decreases by 1.

4. Comparison Operators

Comparison Operators are used for comparing the two values. These operators are mostly used with if-else for executing specific flow after comparison.

Operator Meaning Expression

> Greater than

< Less than a < b

>= Greater than equals to

<= Less than equals to a <= b


{ var num1 = 20 var num2 = 30 { println (“greater number is $num1”) } else { println (“greater number is $num2”)     } }

5. Equality and Non-equality Operators

Kotlin provides a set of logical operators, and these equality and non-equality operators return a boolean value depending on the comparison result. These operators play an important role in the program logic flow by comparing the values and moving the flow according to that.

Operators Meaning Expression

!= Not equal to a != b

== It is equal to a ==b


{ var a = 3 var b = 6  println (a==b)     }

6. Logical Operators

Kotlin provides the below-mentioned 3 logical operators, which return boolean values, either true or false.

Operators Meaning Expression

&& True if all the values are true a && b (meaning a and b)

|| True if any of the value is true

! True if the value is false!  a (meaning not a )


{  var a = 20 var b = 4 var c = -8 val answer : Boolean }

7. In operator

Operators Meaning Expression

in Is a present in collection b a in b

Not in Is a not present in Collection b a !in b


{ val array = intArrayOf(10, 20, 30 ,40) If (20 in array) { println (“yes 20 is present in array”)       } else { println (“no 20 is not present in array”) } }

8. Range Operator

Kotlin uses the range operator to create a range of values. This operator is handy when working with loops. It is unnecessary to define every value if it is sequential; it is better to use a shortcut and define the range specifying the lowest and highest value.

Operator Meaning Expression

. . If i is in the range from a to b For (i in a . .b)


{ for (i in 1..10) { println (“value of i is $i”)     }                                         }

9. Indexed Access Operator

Indexed Access operators access any value at a particular index in an array. In Kotlin array starts with an index of 0.

Operators Meaning

a [i] Get the value at index’ i’ in an array ‘a’

a [i] = b Set the value b at the ‘i’ index of an array ‘a’


{ val array = intArrayOf(10, 20, 30, 40, 50) var value = array[1] println(“value at index 1 is $value”)         array[1] = 90 println (“recent value at index 1 is $array[1]”)  }

10. Bitwise Operators

Like other programming languages, e.g., C, C++, and Java, Kotlin has no bitwise operators. It has various functions that work for bitwise operations.

Functions Meaning

shl Signed shift left

shr Signed shift right

ushr Unsigned shift right

and Bitwise and

or Bitwise or

xor Bitwise xor

inv Bitwise Inversion


{ var a = 12 var b = 10 val result1 : Int val result2 : Int result1 = a and b result2 = a or b println (“final result of and operation is $result1”)  Println (“final result of or operation is $result2”)  // final result of or operation is 14 }

Recommended Articles

This has been a guide to Kotlin Operators. Here we discuss the introduction, different operators used in Kotlin, and their examples. You can also go through our other suggested articles to learn more –

How To Mount Remote Directories In Linux With Sshfs

There’s certainly no shortage of solutions when it comes to syncing files between two devices. While Google Drive and Microsoft OneDrive may not give you official Linux clients, NextCloud and others do. But maybe you don’t trust a big corporation to store your files. Or, maybe, you want more security than NextCloud offers. With all the components that go into building something like NextCloud, chances are it has more undiscovered security holes than simpler solutions.

Why Use SSHFS?

From the end-user perspective, this is very easy to use, clean and simple. It’s also incredibly secure since it relies on the battle-hardened and proven OpenSSH server. Encryption is also top notch, so you can rest assured that no one can steal your files while they are in transit. A correctly configured up-to-date server that only listens for SSH connections is usually impossible to crack for all but the most skilled attackers (think NSA, security specialists, etc.). And they probably don’t want your files.

Why You Wouldn’t Want to Use SSHFS

If you want the best possible transfer speed, you might want to use other solutions such as NFS. SSHFS is not the slowest if your Internet connection is of high quality, but it’s not the fastest either. And if you want to transfer directories that contain hundreds of small files, it becomes horrible. Also, if you want to fine-tune file sharing settings, based on individual users or other factors, you might want to use other software.

To summarize, if all you need is an easy, secure way to synchronize a remote directory with a local one and aren’t in a huge hurry, you will probably be satisfied with this solution.

Install SSHFS

On Arch Linux based installations, use this command:





If you’re on a Fedora-based distro, use:





On Debian, Ubuntu and family, use:





For those of you that use OpenSUSE, enter this command:





Server Configuration

If you rent a server or VPS, the OpenSSH server daemon is already configured. Follow the steps recommended by your cloud service provider to configure a regular user (non-root). Some let you do this directly from their web control panel and even let you import the public key to allow SSH access. In this case, generate the key pairs locally, with the ssh-keygen command. After, import the public key from “/home/your_username/.ssh/”

If the cloud provider doesn’t offer a tool to easily import SSH public keys, do it manually. At the very least, disallow root login and disable password logins. Use SSH keys exclusively instead: they are impossible to brute-force, as is the case with passwords.

If you want to sync files between two computers at home, just treat one as the server (install openssh-server package and configure) and the other one as the client. The same steps apply.

Mount a Remote Directory Locally with SSHFS

First, create a directory that will be synced with the remote side.





Next, mount the remote directory locally through SSHFS. Replace “user” with the actual username created on your server and “” with the actual IP address of your remote instance.











Of course, if you don’t want to sync the entire home directory of the user on the server side, just replace “/home/user” with “/home/user/some_other_directory” after you create it on the server.

When you want to unmount, use this command:









Hopefully this covers all your needs. But, if it doesn’t, you can read about more command line options in the online SSHFS manual.

Alexandru Andrei

Fell in love with computers when he was four years old. 27 years later, the passion is still burning, fueling constant learning. Spends most of his time in terminal windows and SSH sessions, managing Linux desktops and servers.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.

By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time.

Update the detailed information about List Device Names, Disk And Partition Information In Linux With Lsblk on the website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!