-1

In my centos7 when I add and partition a new disk to the machine and try to make files system on top of it , I get this annoying error message

/dev/sdb is apparently in use by the system; will not make a filesystem here

The point is that the disk is an ISCSI one and it is pretty independent. I have another SATA device as well. I don't know what is keeping this newly partitioned disk busy, and rebooting the server seems pointless and I also tried partprobe, but no luck!

Here is my fdisk -l output

Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes`
Disk label type: dos`
Disk identifier: 0x00004776`

Device    Boot      Start    End      Blocks   Id  System

/dev/sda1   *        2048     2099199     1048576   83  Linux

/dev/sda2         2099200    41943039    19921920   8e  Linux LVM

Disk /dev/mapper/cl-root: 18.2 GB, 18249416704 bytes, 35643392 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/cl-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdb: 1265 MB, 1265734656 bytes, 2472138 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0000a7c3

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     2342911     1170432   83  Linux
guntbert
  • 553
  • 7
  • 21
Houdini
  • 11
  • 1
  • 3
  • Can you please post the fdisk -l output? – Peter Oct 11 '18 at 19:29
  • Thanks for you reply, i've posted fdisk -l output. – Houdini Oct 12 '18 at 03:59
  • OK, so it IS present. I am suspecting an iSCSI permissions issue. Also, it might be possible that the drive is considered part of a RAID in which case you need to remove it from the RAID. – Peter Oct 12 '18 at 13:19
  • The drive is definitely not a part of RAID , because i've filled it with zero using . `dd if=/dev/zero of=/dev/sdb` so any RAID signature should be wiped out. – Houdini Oct 13 '18 at 08:27

2 Answers2

1

Your disk has a partition on it, yet you try to create the filesystem directly on the disk. Either you remove the partition (which is usually not recommended and gains you nothing) or you create your filesystem on /dev/sdb1 instead of /dev/sdb.

Gerald Schneider
  • 19,757
  • 8
  • 52
  • 79
1

I made it work. There was a targetcli running which was keeping the new disk busy.
I simply issued systemctl stop target.service and after that I was able to create a filesystem on top if my disk.

guntbert
  • 553
  • 7
  • 21
Houdini
  • 11
  • 1
  • 3