Bug 214479 - Cannot create or mount ext2 file system on a USB external drive
Summary: Cannot create or mount ext2 file system on a USB external drive
Status: Closed Unable to Reproduce
Alias: None
Product: Base System
Classification: Unclassified
Component: usb (show other bugs)
Version: 11.0-RELEASE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-usb (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-13 16:13 UTC by giorgioxyzb
Modified: 2021-01-25 03:03 UTC (History)
3 users (show)

See Also:


Attachments
Tail of dmesg out after mount failed. (526 bytes, text/plain)
2020-05-12 20:43 UTC, donaldcallen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description giorgioxyzb 2016-11-13 16:13:00 UTC
I have two external 1T USB drives which I use for backups. Both contain one MBR partition which is formatted with ext2fs. I can mount and use the first drive under FreeBSD without any problems. On the second drive, I cannot mount the ext2fs. Here is the model of the drive:

# smartctl -i /dev/da1
smartctl 6.5 2016-05-07 r4318 [FreeBSD 11.0-RELEASE-p1 amd64] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Blue Mobile
Device Model:     WDC WD10JPVX-00JC3T0
Serial Number:    WD-WXQ1E945D4NJ
LU WWN Device Id: 5 0014ee 65add21b2
Firmware Version: 01.01A01
User Capacity:    1,000,204,886,016 bytes [1.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5400 rpm
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2 (minor revision not indicated)
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Sat Nov 12 11:53:56 2016 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

I have scanned the drive for bad sectors and nothing was found.

I have partitioned and formatted with ext2fs under GNU/Linux: GNU/Linux can mount and use the drive. Under FreeBSD I get the following errors:
# mount -t ext2fs /dev/da1s1 mnt
mount: /dev/da1s1: Invalid argument

If I try to check the file system I get the following error:
# fsck_ext2fs -f -n -v /dev/da1s1
e2fsck 1.42.13 (17-May-2015)
/sbin/e2fsck: Attempt to read block from filesystem resulted in short read while trying to open /dev/da1s1
Could this be a zero-length partition?

I have also partitioned the drive under FreeBSD using gpart and formatted with ufs, and everything seems to work OK: I can mount, write files, read files.

I have tried formatting with ext2fs from FreeBSD and got warnings:
# mke2fs /dev/da1s1
mke2fs 1.42.13 (17-May-2015)
/dev/da1s1 contains a ext2 file system
Proceed anyway? (y,n) y
Warning: could not erase sector 2: Attempt to write block to filesystem resulted in short write
Creating filesystem with 244188598 4k blocks and 61054976 inodes
Filesystem UUID: 22101a6d-fda0-4bfb-98a2-353b27953c13
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                            
Warning: could not read block 0: Attempt to read block from filesystem resulted in short read
Warning: could not erase sector 0: Attempt to write block to filesystem resulted in short write
Writing inode tables: done                            
Writing superblocks and filesystem accounting information:    0/7453

If I check the filesystem from FreeBSD I get the same errors:
/sbin/e2fsck -f -n /dev/da1s1 
e2fsck 1.42.13 (17-May-2015)
/sbin/e2fsck: Attempt to read block from filesystem resulted in short read while trying to open /dev/da1s1
Could this be a zero-length partition?

So, I have these problems only with this disk and only with ext2fs. One thing that occurred to me, is that GNU/Linux reports a physical sector size of 2048 bytes while for the other working disk it reports a physical sector size of 512.
Comment 1 donaldcallen 2020-05-12 20:43:34 UTC
Created attachment 214425 [details]
Tail of dmesg out after mount failed.
Comment 2 donaldcallen 2020-05-12 20:46:32 UTC
I am also seeing this problem with 12.1. My attempt to mount read-only results in "mount: /dev/da0p1: No such file or directory". USB drive has a GPT partition table and one partition, spanning the whole disk.
Comment 3 donaldcallen 2020-05-19 18:22:44 UTC
I retried this today and it worked -- I was able to mount an ext4 filesystem read-only. I'm not sure what I did wrong previously, but I don't want to confuse the issue here with a bogus report of a problem that I've now confirmed doesn't exist.