You are not logged in.

#1 2025-11-15 21:35:43

Dave_G
Member
Registered: 2021-09-02
Posts: 19

[SOLVED] NVME drive won't mount

In my laptop running Arch Linux I’ve replaced a 1TB NVME drive with a 2TB Western Digital Black SN850X NVME drive. Originally I wanted to encrypt this drive, so encrypted it with cryptsetup, then changed my mind and unencrypted it with cryptsetup –decrypt. I’ve partitioned the drive with a single partition, and formatted the partition with an ext4 filesystem with mkfs.ext4.

But now I can’t mount the partition. It fails with:

# mount /dev/nvme1n1p1 /disk2
mount: /disk2: wrong fs type, bad option, bad superblock on /dev/nvme1n1p1, missing codepage or helper program, or other error.
       dmesg(1) may have more information after failed mount system call.

dmesg shows it being mounted and then immediately unmounted:

[20985.450825] EXT4-fs (nvme1n1p1): mounted filesystem bd10087e-0049-4c5a-bbe1-c9715fc7d115 r/w with ordered data mode. Quota mode: none.
[20985.451278] EXT4-fs (nvme1n1p1): unmounting filesystem bd10087e-0049-4c5a-bbe1-c9715fc7d115.

What’s going on here? Is it perhaps related to the drive being encrypted and then unencrypted?

Last edited by Dave_G (2025-11-18 01:08:28)

Offline

#2 2025-11-16 02:46:01

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 447

Re: [SOLVED] NVME drive won't mount

Dave_G wrote:

unencrypted it with cryptsetup –decrypt

cryptsetup has no "-decrypt" option. If you don't need encrypted partition anymore, you can optionally wipe LUKS metadata, delete LUKS partition and create new partition instead.
What exactly did you do?

Dave_G wrote:

But now I can’t mount the partition.

What is current layout of the drive?

$ lsblk -o NAME,MAJ:MIN,TYPE,UUID,FSTYPE,FSVER,LABEL,MOUNTPOINTS /dev/nvme1n1

With what command did you create ext4 filesystem?

Offline

#3 2025-11-16 23:57:39

Dave_G
Member
Registered: 2021-09-02
Posts: 19

Re: [SOLVED] NVME drive won't mount

dimich wrote:

cryptsetup has no "-decrypt" option.

It does, at least with version 2.8.1. It's not in the man page but it does appear with cryptsetup --help:

# cryptsetup --help | grep decrypt
      --decrypt                           Decrypt LUKS2 device (remove encryption)
dimich wrote:

What exactly did you do?

I removed encryption with cryptsetup --decrypt, deleted the partition with fdisk, added a new partition with fdisk, and formatted the partition with mkfs.ext4.

dimich wrote:

What is current layout of the drive?

$ lsblk -o NAME,MAJ:MIN,TYPE,UUID,FSTYPE,FSVER,LABEL,MOUNTPOINTS /dev/nvme1n1

NAME MAJ:MIN TYPE UUID                                 FSTYPE FSVER LABEL MOUNTPOINTS
nvme1n1
│    259:4   disk                                                         
└─nvme1n1p1
     259:6   part bd10087e-0049-4c5a-bbe1-c9715fc7d115 ext4   1.0    

cryptsetup status shows that the partition is not encrypted:

# cryptsetup status bd10087e-0049-4c5a-bbe1-c9715fc7d115
/dev/mapper/bd10087e-0049-4c5a-bbe1-c9715fc7d115 is inactive.
dimich wrote:

With what command did you create ext4 filesystem?

mkfs.ext4.

It all looks good to me, but it still won't mount so I don't know what I'm missing:

# mount /dev/nvme1n1p1 /disk2
mount: /disk2: wrong fs type, bad option, bad superblock on /dev/nvme1n1p1, missing codepage or helper program, or other error.

Offline

#4 2025-11-17 05:51:32

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 447

Re: [SOLVED] NVME drive won't mount

Dave_G wrote:

It does, at least with version 2.8.1. It's not in the man page but it does appear with cryptsetup --help

This is an option for "reencrypt" action. "cryptsetup --decrypt" simply won't work. Anyway, if you created another filesystem on that partition, it doesn't matter anymore.

Just to be sure, please show output of

# fdisk -l /dev/nvme1n1
Dave_G wrote:

I removed encryption with cryptsetup --decrypt, deleted the partition with fdisk

Did you remove the mapping with "cryptfs close ..." before deleting/creating partitions?

Dave_G wrote:

cryptsetup status shows that the partition is not encrypted

# cryptsetup status bd10087e-0049-4c5a-bbe1-c9715fc7d115
/dev/mapper/bd10087e-0049-4c5a-bbe1-c9715fc7d115 is inactive.

cryptsetup is only saying that mapping named "bd10087e-0049-4c5a-bbe1-c9715fc7d115" is inactive. Probably because there is no such mapping anymore. To be sure, check output of

dmsetup status
Dave_G wrote:
dimich wrote:

With what command did you create ext4 filesystem?

mkfs.ext4

I meant full command with options.

Dave_G wrote:

It all looks good to me, but it still won't mount so I don't know what I'm missing.

My guess is that you created ext4 filesystem while the device was still mapped. Best option is to re-create ext4. Make sure that block device is not mapped: "dmsetup ls" should NOT list "(259:6)". Just in case, re-read partitions with "partprobe /dev/nvme1n1". Then create fs with "mkfs.ext4 /dev/nvme1n1p1" and desired options.

Offline

#5 2025-11-17 16:58:33

Dave_G
Member
Registered: 2021-09-02
Posts: 19

Re: [SOLVED] NVME drive won't mount

dimich wrote:

Just to be sure, please show output of

# fdisk -l /dev/nvme1n1
# fdisk -l /dev/nvme1n1
Disk /dev/nvme1n1: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: WD_BLACK SN850X 2000GB                  
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: FC79792D-DA19-430F-9913-D7DD679566BC

Device         Start        End    Sectors  Size Type
/dev/nvme1n1p1  2048 3907028991 3907026944  1.8T Linux filesystem
dmich wrote:

To be sure, check output of

dmsetup status
# dmsetup status
archlinux-root: 0 1981595648 linear
archlinux-swap: 0 8388608 linear
cryptlvm: 0 1989986304 crypt
dmich wrote:

My guess is that you created ext4 filesystem while the device was still mapped. Best option is to re-create ext4. Make sure that block device is not mapped: "dmsetup ls" should NOT list "(259:6)". Just in case, re-read partitions with "partprobe /dev/nvme1n1". Then create fs with "mkfs.ext4 /dev/nvme1n1p1" and desired options.

dmsetup does not list "(259:6)":

# dmsetup ls
archlinux-root	(253:2)
archlinux-swap	(253:1)
cryptlvm	(253:0)

After running "partprobe /dev/nvme1n1", I recreate the filesystem, which completes normally:

# mkfs.ext4 /dev/nvme1n1p1
mke2fs 1.47.3 (8-Jul-2025)
/dev/nvme1n1p1 contains a ext4 file system
	last mounted on Sun Nov 16 19:57:52 2025
Proceed anyway? (y,N) y
Discarding device blocks: done
Creating filesystem with 488378368 4k blocks and 122101760 inodes
Filesystem UUID: c4553066-e8c0-4aac-9f61-ad6dbd52ecc0
Superblock backups stored on blocks:
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
	4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
	102400000, 214990848

Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done

But the filesystem still won't mount:

# mount /dev/nvme1n1p1 /disk2
mount: /disk2: wrong fs type, bad option, bad superblock on /dev/nvme1n1p1, missing codepage or helper program, or other error.

I'm still baffled. Is it possible that the device (Western Digital Black SN850X) is not supported? It is running the latest firmware.

Offline

#6 2025-11-17 18:56:26

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 447

Re: [SOLVED] NVME drive won't mount

Dave_G wrote:

I recreate the filesystem, which completes normally
...
But the filesystem still won't mount

Let's check nvme first:

# nvme smart-log /dev/nvme1

Check filesystem:

# fsck.ext4 -f -n /dev/nvme1n1p1

Try to read entire partition (will take some time):

# dd if=/dev/nvme1n1 of=/dev/null bs=4096 iflag=direct conv=noerror status=progress

Do you have ext4 partitions on other drive? Just in case, check filesystems supported by kernel (if you use custom kernel):

$ grep ext4 /proc/filesystems

Doesn't /etc/fstab have /disk2 entry? What is content of /etc/fstab?

If everything above is ok, post full journal after attempt to mount filesystem.
According to dmesg from OP it looks like filesystem is mounted but then immediately unmounted. However, it is not clear if that message is relevant to the current issue. Do you have any custom systemd.mount or systemd.service units possibly related to /disk2/ mount point?

Offline

#7 2025-11-17 23:58:50

Dave_G
Member
Registered: 2021-09-02
Posts: 19

Re: [SOLVED] NVME drive won't mount

I just found the problem. At one point I did an "ls -l /" and found this:

# ls -l /
total 16404
.
.
.
-rw-------   1 root    root    16777216 Nov 14 01:19 disk2

I have no idea how that file got there (the contents were binary), or what happened to the /disk2 directory, but I deleted the file, recreated the /disk2 directory, and the device mounts now.

Thanks for all the help.

Last edited by Dave_G (2025-11-18 01:42:08)

Offline

Board footer

Powered by FluxBB