Tuesday, September 17, 2013

Can't open /dev/sdb1 exclusively. Mounted filesystem?

This is an issue we will get for many reasons, one reason we get this error is when we try to use the partition which is already mounted or used in your machine. This occurs some times due to LVM which is not properly implemented

If you fee this is new partition and want to unlock the file from kernel follow below steps

Step1: Check what are the partitions known to the kernel by using proc file system as shown bleow

[root@gnani surendra]# cat /proc/partitions
major minor  #blocks  name

   8        0    8388608 sda
   8        1    5120000 sda1
   8        2    1024000 sda2
   8        3    2240906 sda3
   8       16    8388608 sdb
   8       17     112423 sdb1
   8       18     112455 sdb2
   8       19     112455 sdb3
 253        0     112423 dm-0
 253        1     112455 dm-1
 253        2     112455 dm-2

Step2: Check if your required partition is in the list or not? If yes, then try to check status of that disk by using dmsetup command as shown below

[root@gnani surendra]# dmsetup status
sdb3: 0 224910 linear
sdb2: 0 224910 linear
sdb1: 0 224847 linear

Step3: If you see your desired partition, try to unlink it from the kernel

dmsetup remove sdb1

Now try to use your partition and see if you still have issue. Hope this helps someone in need.


Post a Comment