Getting an “is not a block special device.” error when trying to mount an 8TB disk in CentOS 7.6

7,027

Solution 1

Your device might already have been partitioned and have a file system. You may need to first get rid of everything.

Use fdisk on the disk itself, /dev/sdc rather than on the partition /dev/sdc1:

sudo fdisk -cu /dev/sdc

If you have any existing partitions, first delete them using the command d, and finally w to write the partition table and exit.

Reissue fdisk -cu /dev/sdc and use n to create a new partition with maximum size and w again.

Check that everything is correct using fdisk -lu /dev/sdc.

You may finally format the new partition:

sudo mke2fs -t ext4 /dev/sdc1

Or alternatively:

sudo mkfs.ext4 /dev/sdc1

Solution 2

My guess is you had created a regular file there somehow (or maybe a symlink to such file). Check it. If it was a block device then in the output of

ls -l /dev/sdc1

the first letter would be b; additionally

file /dev/sdc1

would say block special. If this is not the case, investigate what the object really is. It probably shouldn't be there in the first place. Note mounting a regular file uses a loop device, this fits your case.

If the object is indeed a regular file or a symlink, umount it, then remove (rm) or move (mv) it out of the way. Keep in mind mke2fs operated on the file, so if you already put any important data in the filesystem, it's in the file, not in the partition.

To recreate a proper /dev/sdc1 as a block device, invoke sudo partprobe. This assumes there is no problem with /dev/sdc and its partition table. You should also invoke mke2fs again because the partition wasn't even touched by your previous mke2fs.


A plausible cause of having a regular file there is writing an image file to /dev/sdc1 without making sure the target exists (normally as a block device). Such operation on an nonexistent target creates a regular file.

If the problem reappears (like after reboot, after connecting the external drive again) it means something recreates the file. This may be due to some poorly written script that assumes /dev/sdc1 always exists. Be warned such script can overwrite your actual partition when the drive is connected. Hopefully there is no script at all and the whole problem is because of one-time mishap as described above.

Share:
7,027
anil
Author by

anil

Updated on September 18, 2022

Comments

  • anil
    anil almost 2 years

    I'm trying to format and mount a 8TB external as an ext4 and it doesn't seem to work right. The drive is a Seagate 8TB expansion desktop drive. Model number is STEB8000402.

    I can create my partition using gdisk:

    sdc               8:32   0   7.3T  0 disk
    └─sdc1            8:33   0   7.3T  0 part
    

    But when I create the filesystem I get a weird error that says: “/dev/sdc1 is not a block special device.” however it seems to complete:

    # mke2fs -t ext4 /dev/sdc1
    mke2fs 1.42.9 (28-Dec-2013)
    /dev/sdc1 is not a block special device.
    Proceed anyway? (y,n) y
    Discarding device blocks: done
    Filesystem label=
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    Stride=0 blocks, Stripe width=0 blocks
    246512 inodes, 984801 blocks
    49240 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=1008730112
    31 block groups
    32768 blocks per group, 32768 fragments per group
    7952 inodes per group
    Superblock backups stored on blocks:
            32768, 98304, 163840, 229376, 294912, 819200, 884736
    
    Allocating group tables: done
    Writing inode tables: done
    Creating journal (16384 blocks): done
    Writing superblocks and filesystem accounting information: done
    

    Afterwards though, when mounting it doesn't seem to work and it mounts /dev/loop0 instead? I'm not even sure what that is and the filesystem is the wrong size.

    /dev/loop0               4.0G   16M  3.7G   1% /mnt/test
    

    I was reading apparently this is some new type of drive with sectors not in the normal place? Any help would be appreciated.

    • davidgo
      davidgo over 5 years
      Is the partitioning method GPT? MBR eont work for large disks.
    • harrymc
      harrymc over 5 years
      Try to umount before running mke2fs, or use -F.
    • anil
      anil over 5 years
      it is set to gpt, I mount after mke2fs
    • anil
      anil over 5 years
      i formatted the drive as NTFS in windows, just to make sure the partition is right, but mounting the drive still only shows up as 3.8G when running df-h
    • Giacomo1968
      Giacomo1968 over 5 years
      Please edit your question to add specifics such as what version of CentOS you are on and what the exact brand, make and model of the drive is. Also, did you read this article on drives not showing correct sizes past 2TB? While you are showing 4TB it seems like it might be helpful.
    • anil
      anil over 5 years
      i had followed that guide but it didn't help, stuck in the same step. the drive is a seagate 8tb expansion desktop drive. specifically the STEB8000402
  • anil
    anil over 5 years
    you where right apparently i created a file instead of a partition somehow. I removed it and followed harrymc instructions and now everything is working. thanks to you both!
  • anil
    anil over 5 years
    I got it working thank you! the -cu switches didn't work for fdisk but i didn't need them it turned out. the mkfs command worked fine.
  • harrymc
    harrymc over 5 years
    If you "followed harrymc instructions and now everything is working", shouldn't I be getting some credit?
  • anil
    anil over 5 years
    indeed, but i can only pick 1 answer. although your instructions helped i already knew them. the issue was the fact i had a file instead of a partition. i wish i could pick both, as the issue isn't complete with just one post. Hopefully anyone else that comes across this can piece it together.
  • harrymc
    harrymc over 5 years
    You may actually pick 2 answers: One for acceptance and one for the bounty.