Wrong capacity detected for hard drives attached to external enclosure after reboot

Open
#4,050 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
c, linux

Research direction

Start by reproducing the Raspberry Pi 4 setup with the Orico 4 Bay enclosure, rebooting while it remains powered, and comparing blockdev --getsize64 and df -PTh for the affected disk. Use the reported Raspberry Pi OS and kernel version as the baseline. Done means the disk capacity is detected correctly after reboot or power cycling the Pi without powering off the enclosure.

Written by the indexing model from the issue text.

Description

Is this the right place for my bug report?
I've reported this bug that I was thinking was related to blockdev command, but the developer suggested that it is a Kernel issue

Describe the bug
I have an Orico 4 Bay enclosure that I use with 2 HDDs for now on a Rspberry Pi4 64 bit updated to the latest version of Debian Buster and running OMV.
If I turn on the enclosure and afterwards the system everything works fine. If I reboot the system, or if I turn it of and turn it on again without turning off the enclosure at the next boot the blockdev

This is the output of the command when I turn on the enclosure and power up the system afterwards:

pi@raspberrypi:~ $ sudo blockdev --getsize64 /dev/sdb
8001563222016
pi@raspberrypi:~ $ sudo df -PTh | grep /dev/sdb
/dev/sdb1      btrfs     7.3T  2.2T  5.2T  29% /srv/dev-disk-by-label-01

This is the output of the command if I reboot or if I shutdown and power on again without turning off and on the enclosure:

pi@raspberrypi:~ $ sudo blockdev --getsize64 /dev/sdc
129986248068418560
pi@raspberrypi:~ $ sudo df -PTh | grep /dev/sdc
/dev/sdc1      btrfs     7.3T  2.2T  5.2T  29% /srv/dev-disk-by-label-01

If I use the system in this condition after some minutes it becomes unstable and I have to turn everything off and back on.

To reproduce
I've tried and I experience this issue even on new OS installation of Raspberry OS 32 and 64 bits

Expected behaviour
Be able to detect the disk capacity correctly if I reboot the Pi or if I turn it off and back on again without powering off the enclosure.

System

  • Which model of Raspberry Pi?
    Pi4 4GB
  • Which OS and version (cat /etc/rpi-issue)?
    Raspberry Pi reference 2020-05-27
    Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 30e2dd32ba47cc3bec15ab1413c16a17e5797775, stage4
  • Which firmware version (vcgencmd version)?
    Copyright (c) 2012 Broadcom
    version ab1181cc0cb6df52bfae3b1d3fef0ce7c325166c (clean) (release) (start_cd)
  • Which kernel version (uname -a)?
    Linux raspberrypi 5.4.79-v8+ #1373 SMP PREEMPT Mon Nov 23 13:32:41 GMT 2020 aarch64 GNU/Linux
Dominant language
C
Stars
13.2k
Forks
5.5k
Avg merge
2d 21h
Merged PRs (30d)
21

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from raspberrypi/linux

All issues in raspberrypi/linux

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.