Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Hard drive FS is not recognized by Gentoo
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Pelvur
n00b
n00b


Joined: 06 Jul 2020
Posts: 21

PostPosted: Mon Jul 06, 2020 6:05 am    Post subject: [SOLVED] Hard drive FS is not recognized by Gentoo Reply with quote

I have an HDD (use it in enclosure as external drive) formatted to ext4 that is not recognized by Gentoo. I have no problem reading the same drive on the same laptop with Debian install, so it is not drive issue, I suppose. I assume I may be missing some kernel modules, but digging through menuconfig did not help me. Here are some data about the drive:

fdisk -l:

Code:
Disk /dev/sdc: 298.9 GiB, 320072933376 bytes, 625142448 sectors
Disk model:                 
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: 2571F24E-46CC-4A8E-BA50-F65884A54C76

Device     Start       End   Sectors   Size Type
/dev/sdc1   2048 625141759 625139712 298.1G Linux filesystem


gdisk -l /dev/sdc:

Code:
GPT fdisk (gdisk) version 1.0.4

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sdc: 625142448 sectors, 298.1 GiB
Model:                 
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 2571F24E-46CC-4A8E-BA50-F65884A54C76
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 625142414
Partitions will be aligned on 2048-sector boundaries
Total free space is 2669 sectors (1.3 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048       625141759   298.1 GiB   8300  320GB


When I run fsck under Debian, it gives no error and checks out well. On Gentoo I get following:

fsck -a /dev/sdc:

Code:
fsck from util-linux 2.35.1
fsck.ext2: Bad magic number in super-block while trying to open /dev/sdc
/dev/sdc:
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
 or
    e2fsck -b 32768 <device>

/dev/sdc contains `DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x0,0,1), end-CHS (0x3ff,254,63), startsector 1, 625142447 sectors, extended partition table (last)' data



fsck -a /dev/sdc1:
Code:

fsck from util-linux 2.35.1
fsck.ext2: Bad magic number in super-block while trying to open /dev/sdc1
/dev/sdc1:
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
 or
    e2fsck -b 32768 <device>

/dev/sdc1 contains `GPT data structure (nonstandard: at LBA 0), version 1.0, GUID: 2571f24e-46cc-4a8e-ba50-f65884a54c76, disk size: 625142448 sectors (sector size unknown)' data


Running suggested
Code:
e2fsck -b 8193 <device>
ends up in the same way.

It seems that gpt disklabel is creating problem, but I don't understand why and how to solve it (short of reformatting the drive and removing gpt label).

One more thing as I feel it may matter: my main drive (SSD) is formatted with MBR (ext4), not GPT.

Is anyone here able to steer me in right direction?


Last edited by Pelvur on Mon Jul 06, 2020 11:10 pm; edited 1 time in total
Back to top
View user's profile Send private message
Banana
Moderator
Moderator


Joined: 21 May 2004
Posts: 1879
Location: Germany

PostPosted: Mon Jul 06, 2020 6:27 am    Post subject: Reply with quote

I hope you have a backup of the data which is on this disk? If so, what happens if you format the disk with a gparted iso on CD or USB to rule out any problems with the OS?
_________________
Forum Guidelines

PFL - Portage file list - find which package a file or command belongs to.
My delta-labs.org snippets do expire
Back to top
View user's profile Send private message
Pelvur
n00b
n00b


Joined: 06 Jul 2020
Posts: 21

PostPosted: Mon Jul 06, 2020 6:38 am    Post subject: Reply with quote

Banana wrote:
I hope you have a backup of the data which is on this disk? If so, what happens if you format the disk with a gparted iso on CD or USB to rule out any problems with the OS?


I don't really want to reformat the drive, but I'm pretty sure the same thing will happen. I have another drive with gpt label (formatted to NTFS) and it behaves the same way.
Also, the second drive I have is 4TB, all in one partition, but lsblk and gdisk say it has 2TB partition (which I believe is limit for MBR) and the rest is unused. It makes me pretty sure that core of the problem is around GPT support, I just don't understand what am I missing and why.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Mon Jul 06, 2020 7:24 am    Post subject: Reply with quote

Does your kernel have GPT support?
Back to top
View user's profile Send private message
fturco
Veteran
Veteran


Joined: 08 Dec 2010
Posts: 1181

PostPosted: Mon Jul 06, 2020 7:26 am    Post subject: Re: Hard drive FS is not recognized by Gentoo Reply with quote

Pelvur wrote:
fsck -a /dev/sdc1:
Code:
fsck.ext2: Bad magic number in super-block while trying to open /dev/sdc1

What happens if you use fsck.ext4 instead of fsck.ext2?
Back to top
View user's profile Send private message
Pelvur
n00b
n00b


Joined: 06 Jul 2020
Posts: 21

PostPosted: Mon Jul 06, 2020 7:29 am    Post subject: Reply with quote

Ant P. wrote:
Does your kernel have GPT support?


I believe so. I have the following enabled:
Code:

-*- Enable the block layer --->
   Partition Types --->
      [*] Advanced partition selection
      [*] EFI GUID Partition support


Is there anything else I need to do to enable GPT?
Back to top
View user's profile Send private message
Pelvur
n00b
n00b


Joined: 06 Jul 2020
Posts: 21

PostPosted: Mon Jul 06, 2020 7:31 am    Post subject: Re: Hard drive FS is not recognized by Gentoo Reply with quote

fturco wrote:
Pelvur wrote:
fsck -a /dev/sdc1:
Code:
fsck.ext2: Bad magic number in super-block while trying to open /dev/sdc1

What happens if you use fsck.ext4 instead of fsck.ext2?


Same thing, no difference.
Back to top
View user's profile Send private message
fturco
Veteran
Veteran


Joined: 08 Dec 2010
Posts: 1181

PostPosted: Mon Jul 06, 2020 10:18 am    Post subject: Reply with quote

Does anything relevant appear in dmesg when you try to access your partition?
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Mon Jul 06, 2020 11:44 am    Post subject: Reply with quote

Pelvur wrote:
Ant P. wrote:
Does your kernel have GPT support?


I believe so. I have the following enabled:
Code:

-*- Enable the block layer --->
   Partition Types --->
      [*] Advanced partition selection
      [*] EFI GUID Partition support


Is there anything else I need to do to enable GPT?

That looks fine, guess the problem lies elsewhere.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54810
Location: 56N 3W

PostPosted: Mon Jul 06, 2020 12:43 pm    Post subject: Reply with quote

Pelvur,

Do you have ext2 support in your kernel, or ext4 with Use ext4 for ext2 ?

Do not run fsck unless you have a backup. It makes a bad situation worse.
Yes, it will make the filesystem self consistent by 'guessing' what should be there but it may loose you data in the process.

What does
Code:
dumpe2fs /dev/sda1 |grep -i back
dumpe2fs 1.45.6 (20-Mar-2020)
  Backup superblock at 8193, Group descriptors at 8194-8194
  Backup superblock at 24577, Group descriptors at 24578-24578
tell you?
Notice the list of backup superblock locations.

If you have a superblock issue, we can feed these to the mount command to try mount with an alternate superblock.
See
Code:
man mount
and
Code:
man ext4


Mount expects the sb parameter to be in 1k block units. Until the superblock has been read, it knows nothing about your filesystem, which will use 4k blocks.
Code:
mount -t ext2 -o ro,sb=131072 /dev/sdc1 /mnt/<someplace>
is always worth a try.
That's the first backup superblock on a filesystem with 4k blocks.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5370
Location: Bavaria

PostPosted: Mon Jul 06, 2020 3:20 pm    Post subject: Reply with quote

I would like to ask what are the differences between your debian installation and gentoo ?
1. If you connect it under debian what is the output of
Code:
tune2fs -l /dev/sda1

2. What tells "uname -a" under debian and gentoo ?
3. Where it was formatted ? (debian?)
4. ... with security options ?
Back to top
View user's profile Send private message
Pelvur
n00b
n00b


Joined: 06 Jul 2020
Posts: 21

PostPosted: Mon Jul 06, 2020 4:21 pm    Post subject: Reply with quote

fturco wrote:
Does anything relevant appear in dmesg when you try to access your partition?


This is what I believe is related to my disk in dmesg:

Code:
[  246.259470] usb 2-3: new high-speed USB device number 3 using ehci-pci
[  246.463712] usb 2-3: New USB device found, idVendor=152d, idProduct=1561, bcdDevice= 2.04
[  246.463714] usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  246.463716] usb 2-3: Product: SABRENT
[  246.463717] usb 2-3: Manufacturer: SABRENT
[  246.463718] usb 2-3: SerialNumber: DB9876543214E
[  246.464000] usb-storage 2-3:1.0: USB Mass Storage device detected
[  246.464706] scsi host8: usb-storage 2-3:1.0
[  247.498121] scsi 8:0:0:0: Direct-Access     SABRENT                   0204 PQ: 0 ANSI: 6
[  247.498334] scsi 8:0:0:0: Attached scsi generic sg2 type 0
[  248.627857] sd 8:0:0:0: [sdc] 625142448 512-byte logical blocks: (320 GB/298 GiB)
[  248.628986] sd 8:0:0:0: [sdc] Write Protect is off
[  248.628990] sd 8:0:0:0: [sdc] Mode Sense: 47 00 00 08
[  248.629976] sd 8:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[  248.667373]  sdc: sdc1
[  248.672019] sd 8:0:0:0: [sdc] Attached SCSI disk
Back to top
View user's profile Send private message
Pelvur
n00b
n00b


Joined: 06 Jul 2020
Posts: 21

PostPosted: Mon Jul 06, 2020 4:34 pm    Post subject: Reply with quote

NeddySeagoon wrote:
Pelvur,
Do you have ext2 support in your kernel, or ext4 with Use ext4 for ext2 ?


Yes, I have following enabled:
Code:
File systems  --->
<*> Second extended fs support
 <*> The Extended 4 (ext4) filesystem                           
  │ │    [*]   Ext4 POSIX Access Control Lists                           
  │ │    [*]   Ext4 Security Labels



Quote:
What does
Code:
dumpe2fs /dev/sda1 |grep -i back
dumpe2fs 1.45.6 (20-Mar-2020)
  Backup superblock at 8193, Group descriptors at 8194-8194
  Backup superblock at 24577, Group descriptors at 24578-24578
tell you?
Notice the list of backup superblock locations.


Here it is:
Code:
# dumpe2fs /dev/sdc1 |grep -i back
dumpe2fs 1.45.5 (07-Jan-2020)
dumpe2fs: Bad magic number in super-block while trying to open /dev/sdc1

.
Quote:
Code:
mount -t ext2 -o ro,sb=131072 /dev/sdc1 /mnt/<someplace>
is always worth a try.

Didn't work:
Code:
 # mount -t ext2 -o ro,sb=131072 /dev/sdc1 /mnt/external   
mount: /mnt/external: wrong fs type, bad option, bad superblock on /dev/sdc1, missing codepage or helper program, or other error.


Tried it with ext4, same result.
Back to top
View user's profile Send private message
molletts
Tux's lil' helper
Tux's lil' helper


Joined: 16 Feb 2013
Posts: 131

PostPosted: Mon Jul 06, 2020 5:08 pm    Post subject: Reply with quote

Backing up to really basic stuff, what does:
Code:
file -s /dev/sdc1

report?
Back to top
View user's profile Send private message
Pelvur
n00b
n00b


Joined: 06 Jul 2020
Posts: 21

PostPosted: Mon Jul 06, 2020 5:08 pm    Post subject: Reply with quote

pietinger wrote:
I would like to ask what are the differences between your debian installation and gentoo ?
1. If you connect it under debian what is the output of
Code:
tune2fs -l /dev/sda1


Here it is for Debian:
Code:
# tune2fs -l /dev/sdc1
tune2fs 1.44.5 (15-Dec-2018)
Filesystem volume name:   <none>
Last mounted on:          /media/pavel/130af793-05e3-49a8-8337-d1637c0d6393
Filesystem UUID:          130af793-05e3-49a8-8337-d1637c0d6393
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags:         signed_directory_hash
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              19537920
Block count:              78142464
Reserved block count:     3907123
Free blocks:              57260948
Free inodes:              19532495
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      1005
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Flex block group size:    16
Filesystem created:       Sat Jun  6 21:32:59 2020
Last mount time:          Mon Jul  6 11:49:25 2020
Last write time:          Mon Jul  6 11:49:25 2020
Mount count:              1
Maximum mount count:      -1
Last checked:             Sun Jul  5 11:26:04 2020
Check interval:           0 (<none>)
Lifetime writes:          80 GB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:             256
Required extra isize:     32
Desired extra isize:      32
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      16c3fb3a-407f-45a6-b62a-4d92f1627650
Journal backup:           inode blocks
Checksum type:            crc32c
Checksum:                 0xf8bcb924


Here is what Gentoo shows:
Code:
# tune2fs -l /dev/sdc1
tune2fs 1.45.5 (07-Jan-2020)
tune2fs: Bad magic number in super-block while trying to open /dev/sdc1
/dev/sdc1 contains `GPT data structure (nonstandard: at LBA 0), version 1.0, GUID: 2571f24e-46cc-4a8e-ba50-f65884a54c76, disk size: 625142448 sectors (sector size unknown)' data


Quote:
2. What tells "uname -a" under debian and gentoo ?


Debian:
Code:
# uname -a
Linux debianM4400 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) x86_64 GNU/Linux


Gentoo:
Code:
Linux gentooM4400 5.4.38-gentoo #12 SMP Mon Jun 22 04:39:33 CDT 2020 x86_64 Intel(R) Core(TM)2 Extreme CPU X9100 @ 3.06GHz GenuineIntel GNU/Linux

Now, this is suspicious, so we may be onto something. I expected to see 5.4.48 here. In /usr/src I have folders for both linux-5.4.38-gentoo and linux-5.4.48-gentoo. The symlink from linux folder goes to 5.4.48. But if the system loads with 5.4.38 which probably does not have gpt support enabled, this may explain it. Perhaps I missed something when updating the kernel.

Quote:
3. Where it was formatted ? (debian?)

That I don't remember. Surely not Gentoo as I have installed it recently. Most probably Debian, or may even be Ubuntu if I formatted it long enough ago. Could even be GParted live (I still have a cd laying around).

Quote:
4. ... with security options ?

I doubt I would set any security options for this drive as I never do it.
Back to top
View user's profile Send private message
Pelvur
n00b
n00b


Joined: 06 Jul 2020
Posts: 21

PostPosted: Mon Jul 06, 2020 5:13 pm    Post subject: Reply with quote

molletts wrote:
Backing up to really basic stuff, what does:
Code:
file -s /dev/sdc1

report?


Here it is:
Code:
# file -s /dev/sdc1
/dev/sdc1: GPT data structure (nonstandard: at LBA 0), version 1.0, GUID: 2571f24e-46cc-4a8e-ba50-f65884a54c76, disk size: 625142448 sectors (sector size unknown)
Back to top
View user's profile Send private message
fturco
Veteran
Veteran


Joined: 08 Dec 2010
Posts: 1181

PostPosted: Mon Jul 06, 2020 5:33 pm    Post subject: Reply with quote

Pelvur wrote:
Gentoo:
Code:
Linux gentooM4400 5.4.38-gentoo #12 SMP Mon Jun 22 04:39:33 CDT 2020 x86_64 Intel(R) Core(TM)2 Extreme CPU X9100 @ 3.06GHz GenuineIntel GNU/Linux

Now, this is suspicious, so we may be onto something. I expected to see 5.4.48 here. In /usr/src I have folders for both linux-5.4.38-gentoo and linux-5.4.48-gentoo. The symlink from linux folder goes to 5.4.48. But if the system loads with 5.4.38 which probably does not have gpt support enabled, this may explain it. Perhaps I missed something when updating the kernel.

Can you see a kernel image for version 5.4.48 in the /boot directory? You may missed a "make install" command, or you may have forgot to mount /boot before installing the kernel image.
Also, did you update the bootloader configuration (GRUB, for example)?
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5370
Location: Bavaria

PostPosted: Mon Jul 06, 2020 5:38 pm    Post subject: Reply with quote

Pelvur wrote:
[...]The symlink from linux folder goes to 5.4.48. But if the system loads with 5.4.38 which probably does not have gpt support enabled, this may explain it. [...]

Your symlink is only imortant when you compile other programs. If uname says 5.4.38 then this kernel was loaded at boottime. So, yes your actual kernel has no gpt support. Please install 5.4.48.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5370
Location: Bavaria

PostPosted: Mon Jul 06, 2020 5:43 pm    Post subject: Reply with quote

Pelvur wrote:

Here it is for Debian:
Code:
# tune2fs -l /dev/sdc1
tune2fs 1.44.5 (15-Dec-2018)
[...]
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
[...]

I thought this because its debian: You have metadata_csum enabled. Please read https://ext4.wiki.kernel.org/index.php/Ext4_Metadata_Checksums
Back to top
View user's profile Send private message
Pelvur
n00b
n00b


Joined: 06 Jul 2020
Posts: 21

PostPosted: Mon Jul 06, 2020 9:44 pm    Post subject: Reply with quote

fturco wrote:


Can you see a kernel image for version 5.4.48 in the /boot directory? You may missed a "make install" command, or you may have forgot to mount /boot before installing the kernel image.
Also, did you update the bootloader configuration (GRUB, for example)?


Yes, I can see it, here is what I have in /boot:
Code:
ls /boot
config-5.4.38-gentoo          System.map-5.4.48-gentoo
config-5.4.38-gentoo.old      System.map-5.4.48-gentoo.old
config-5.4.48-gentoo          vmlinuz-5.4.38-gentoo
config-5.4.48-gentoo.old      vmlinuz-5.4.38-gentoo.old
initramfs-5.4.38-gentoo.img   vmlinuz-5.4.48-gentoo
System.map-5.4.38-gentoo      vmlinuz-5.4.48-gentoo.old
System.map-5.4.38-gentoo.old


The grub is on debian site, so I wouldn't be surprised if I did not update it after gentoo kernel update.
Back to top
View user's profile Send private message
Pelvur
n00b
n00b


Joined: 06 Jul 2020
Posts: 21

PostPosted: Mon Jul 06, 2020 11:10 pm    Post subject: Reply with quote

Pelvur wrote:

Gentoo:
Code:
Linux gentooM4400 5.4.38-gentoo #12 SMP Mon Jun 22 04:39:33 CDT 2020 x86_64 Intel(R) Core(TM)2 Extreme CPU X9100 @ 3.06GHz GenuineIntel GNU/Linux

Now, this is suspicious, so we may be onto something. I expected to see 5.4.48 here.


Yep, that was it. I even believe I had kernel installed and set up properly, but just in case went through procedure again which did not help. I've updated grub on Debian which did not help either. Then I looked at grub.config and noticed that default menu item for Gentoo calls for old kernel. So I went into advanced option and picked one from there, and it worked, Now kernel 5.4.48 is loaded, and my drive is working. I just need to cleanup grub.config on Debian site to make it default menu option.

fsck still gives the error on sdc but comes out clean on sdc1 so I guess it's fine. Anyway. my main goal was to be able to read the drive.

Thanks for help everyone! Not only you helped me to resolve the issue, I've also learned some new stuff.
Back to top
View user's profile Send private message
fturco
Veteran
Veteran


Joined: 08 Dec 2010
Posts: 1181

PostPosted: Tue Jul 07, 2020 7:07 am    Post subject: Reply with quote

Pelvur wrote:
fsck still gives the error on sdc but comes out clean on sdc1 so I guess it's fine.

/dev/sdc refers to the whole drive, not to a single partition, so it's normal that fsck fails.
fsck should be run on a specific partition (/dev/sdc1) containing a specific filesystem (ext4).
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum