mount /dev/gpt/2TB_SCRATCH fails with "invalid argument"

I moved a scratch ufs disk from another machine, but cannot mount it whether I use the device reference or the label. Either way, I get "invalid argument".

gpart show -l sees the label, and the label is in /dev/gpt/
Code:
=>        40  3907029088  ada3  GPT  (1.8T)
          40    67108864     1  swap  (32G)
    67108904  3839920216     2  2TB_SCRATCH  (1.8T)
  3907029120           8        - free -  (4.0K)

I'm obviously missing something, but what?
 
but cannot mount it whether I use the device reference or the label. Either way, I get "invalid argument".
What is the exact command you used? It may really be an invalid argument you're using. But I do believe you can also get that same message if you try to mount with a different (i.e. the wrong) filesystem type (for example trying to mount ext2 as UFS).
 
The exact commands were mount /dev/gpt/2TB_SCRATCH /Big and mount /dev/ada3p2 /Big.

With the exception of the zpools, all my storage is ufs. I'm strapped for sata ports, so I disconnected the small solid-state drive that usually lives on that port, but its filesystem is also ufs, so unless there's some difference between a standard spinner and a solid-state that I'm not accounting for, I'm baffled.
 
I would expect to see a different error message if the mount point didn't exist. It could be a dirty filesystem, but then I would also expect a different error message (filesystem not clean...).

Does file -s /dev/gpt/2TB_SCRATCH tell you anything?
 
It says "data". Does that tell us anything more than that it's not bootable?

Also: does this look right?

14:52:36 Wed, 11 Dec [root/fastcat]~> ls /dev/gpt
total 0
crw-r----- 1 root operator 0xa2 Dec 11 12:23 2TB_SCRATCH
crw-r----- 1 root operator 0x95 Dec 11 12:19 EFI_part
crw-r----- 1 root operator 0xa8 Dec 11 12:19 swap
 
Data? That doesn't sound good though. Even if it's not bootable it should still be recognized as UFS:

Code:
root@maelcum:~/test # truncate -s 10G test.img
root@maelcum:~/test # mdconfig -a -f test.img
md0
root@maelcum:~/test # gpart create -s GPT /dev/md0
md0 created
root@maelcum:~/test # gpart add -t freebsd-ufs /dev/md0
md0p1 added
root@maelcum:~/test # newfs /dev/md0p1
/dev/md0p1: 10240.0MB (20971440 sectors) block size 32768, fragment size 4096
        using 17 cylinder groups of 626.09MB, 20035 blks, 80256 inodes.
super-block backups (for fsck_ffs -b #) at:
 192, 1282432, 2564672, 3846912, 5129152, 6411392, 7693632, 8975872, 10258112, 11540352, 12822592, 14104832, 15387072, 16669312,
 17951552, 19233792, 20516032
root@maelcum:~/test # file -s /dev/md0p1
/dev/md0p1: Unix Fast File system [v2] (little-endian) last mounted on , last written at Wed Dec 11 19:59:38 2019, clean flag 1, readonly flag 0, number of blocks 2621430, number of data blocks 2535861, number of cylinder groups 17, block size 32768, fragment size 4096, average file size 16384, average number of files in dir 64, pending blocks to free 0, pending inodes to free 0, system-wide uuid 0, minimum percentage of free blocks 8, TIME optimization
 
This is what gpart says. Does it look fishy to you?

14:58:42 Wed, 11 Dec
[root/fastcat]~> gpart show ada3
=> 40 3907029088 ada3 GPT (1.8T)
40 67108864 1 freebsd-swap (32G)
67108904 3839920216 2 freebsd-ufs (1.8T)
3907029120 8 - free - (4.0K)

5:06:56 Wed, 11 Dec
[root/fastcat]~> gpart list ada3
Geom name: ada3
modified: false
state: OK
fwheads: 16
fwsectors: 63
last: 3907029127
first: 40
entries: 128
scheme: GPT
Providers:
1. Name: ada3p1
Mediasize: 34359738368 (32G)
Sectorsize: 512
Stripesize: 4096
Stripeoffset: 0
Mode: r0w0e0
efimedia: HD(1,GPT,5b4a2eb3-c385-11e9-b9ed-0cc47a796c56,0x28,0x4000000)
rawuuid: 5b4a2eb3-c385-11e9-b9ed-0cc47a796c56
rawtype: 516e7cb5-6ecf-11d6-8ff8-00022d09712b
label: swap
length: 34359738368
offset: 20480
type: freebsd-swap
index: 1
end: 67108903
start: 40
2. Name: ada3p2
Mediasize: 1966039150592 (1.8T)
Sectorsize: 512
Stripesize: 4096
Stripeoffset: 0
Mode: r0w0e0
efimedia: HD(2,GPT,7923b090-c385-11e9-b9ed-0cc47a796c56,0x4000028,0xe4e08858)
rawuuid: 7923b090-c385-11e9-b9ed-0cc47a796c56
rawtype: 516e7cb6-6ecf-11d6-8ff8-00022d09712b
label: 2TB_SCRATCH
length: 1966039150592
offset: 34359758848
type: freebsd-ufs
index: 2
end: 3907029119
start: 67108904
Consumers:
1. Name: ada3
Mediasize: 2000398934016 (1.8T)
Sectorsize: 512
Stripesize: 4096
Stripeoffset: 0
Mode: r0w0e0

 
More:

[root/fastcat]~> mount -v /dev/gpt/2TB_SCRATCH /Big
mount: /dev/gpt/2TB_SCRATCH: Invalid argument
/dev/ada0p2 on / (ufs, local, journaled soft-updates, writes: sync 1157 async 9930, reads: sync 7602 async 153, fsid b778405d9714d741)

 
The partition type is still correct. But that really doesn't matter, you can just create a freebsd-ufs partition and format it with newfs_msdos(8) to make a FAT32 filesystem on it. I don't recommend that for obvious reasons of course, but the system won't stop or prevent you from doing it.

Code:
root@maelcum:~/test # file -s /dev/md0p1
/dev/md0p1: Unix Fast File system [v2] (little-endian) last mounted on , last written at Wed Dec 11 19:59:38 2019, clean flag 1, readonly flag 0, number of blocks 2621430, number of data blocks 2535861, number of cylinder groups 17, block size 32768, fragment size 4096, average file size 16384, average number of files in dir 64, pending blocks to free 0, pending inodes to free 0, system-wide uuid 0, minimum percentage of free blocks 8, TIME optimization
root@maelcum:~/test #
root@maelcum:~/test # newfs_msdos /dev/md0p1
/dev/md0p1: 20966272 sectors in 327598 FAT32 clusters (32768 bytes/cluster)
BytesPerSec=512 SecPerClust=64 ResSectors=32 FATs=2 Media=0xf0 SecPerTrack=63 Heads=255 HiddenSecs=0 HugeSectors=20971440 FATsecs=2560 RootCluster=2 FSInfo=1 Backup=2
root@maelcum:~/test # file -s /dev/md0p1
/dev/md0p1: DOS/MBR boot sector, code offset 0x58+2, OEM-ID "BSD4.4  ", sectors/cluster 64, sectors/track 63, heads 255, sectors 20971440 (volumes > 32 MB), FAT (32 bit), sectors/FAT 2560, serial number 0x3d21bed, unlabeled
root@maelcum:~/test # gpart show md0
=>      40  20971440  md0  GPT  (10G)
        40  20971440    1  freebsd-ufs  (10G)
 
A little more poking around convinced me that, probably to squeeze more space out of the disc, I destroyed the original allocations and forgot (aging brain!) that I never finished setting it up again. I did the gparts but not the newfs.

This time I did the whole thing. Many thanks!
 
I'm going to post a bug about that, though, because "invalid argument" is a really poor error message for that situation It should be "no filesystem in partition"
 
"invalid argument" is a really poor error message for that situation It should be "no filesystem in partition"
That's indeed confusing, but FreeBSD doesn't have to know about all possible filesystems (it may contain one!), thus the message should say "no targeted filesystem" (or just mention its type explicitly).
 
There are a lot more confusing error messages. Most of the time it's all the system can give you when it can't make sense of things.

Code:
dice@molly:~/test % echo '#\!/does/not/exist' > test.sh
dice@molly:~/test % chmod +x test.sh
dice@molly:~/test % ./test.sh
./test.sh: Command not found.
 
Back
Top