zgemma-star / meta-zgemma

6 stars 10 forks source link

the wrong removable flag #55

Closed Marchella1983 closed 4 years ago

Marchella1983 commented 4 years ago

About installing the internal Hdd 2.5 Sata on the H9 Twin and Combo. The connected internal drive has the wrong removable flag

root@h9combo:~# cat /sys/block/sda/removable
1

1 means a removable device, such a flag goes on a flash drive. The disc must be with flag 0. The USB drive has the correct flag 0,Flash drive 1,so everything is correct except Sata. Because of this, the drive is mounted in /media/usb and does not stop after a specified time. It is checked by the command: for D in /sys/block/[^l]*; do echo "$D : $(readlink -fn $D/device)"; done[

The string for Sata will contain the names ahci and ata.

zgemma-star commented 4 years ago

cat /sys/block/mmcblk0/removable "0" cat /sys/block/sda/removable "1"

The USB and Sata you can remove but the eMMC is fixed on the mainboard.

In my opinion the notification of removable yes or no is fine.

Dima73 commented 4 years ago

This is Samsung 1TB sata HDD

root@h9combo:~# sfdisk -l

Device Boot Start End Sectors Size Id Type /dev/sda1 8 1953525167 1953525160 931.5G 83 Linux

root@h9combo:~# mount

/dev/sda1 on /media/usb type ext4 (rw,noatime,block_validity,delalloc,barrier,user_xattr,acl) root@h9combo:~# cat /sys/block/sda/removable 1

1 = usb(removable drive)

Flag need 0

zgemma-star commented 4 years ago

When Sata disk is Hotplug-capable then Linux will mount it as a normal USB disk. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/ata/libata-scsi.c?h=v4.4&id=8a3e33cf92c7b7ae25c589eccd1a69ab11cc4353

recommit 8a3e33cf92c7b7ae25c589eccd1a69ab11cc4353 Add mount rules improve mdev for sata mounting. Leave it as is. H10 model example has a bracket option so it's possible to hotplug with sata harddisks.

Dima73 commented 4 years ago

This is the wrong approach. and But this does not apply to the model H9 Twin and Combo.

Dima73 commented 4 years ago

Only Zgemma H10 Combo2.5” is Sata SSD Plugable. And in this case, you can not make the flag removable. All other manufacturers use the flag 0, you are confusing, and the disk will not go into standby mode and will be mounted as USB. Openpli cannot do workarounds like openATV, this is the wrong approach.

Marchella1983 commented 4 years ago

Dima73 Zgemma H9 Twin v2 also has 2.5 - Sata SSD Plugable UHD-4K-satellite-tv-receiver-twin-dvb

zgemma-star please make the flag removable 0 for sata HDD

WanWizard commented 4 years ago

I tend to agree with Zgemma here.

If the disk is hot-pluggable, it is removable. That it is (in this case) a HDD is not relevant.

If this has an impact somewhere, it suggests this flag is used improperly. @Dima73 mentions standby mode, whether or not a device can go in standby is not related to this flag, USB disks can go into standby as well, and they are flagged removable too...

Marchella1983 commented 4 years ago

I think it's right if it's connected via USB and it's detachable, if it's connected via SATA it's not detachable, I don't think anyone will always pull out their HDD connected via SATA

and there is a big difference between USB disks and sata HDD 2.5 if you use sata HDD as hot-pluggable he could be out of order.

WanWizard commented 4 years ago

I disagree,

I have a NAS chassis here with eight 4TB SATA disks connected to an LSI2008 SAS controller. All disks have the removable flag set, as they are hot swappable. Again, the fact that these are SATA devices, or HDDs, is not relevant for the flag.

The flag simply means "device can be removed while the host is running". If you give it another meaning, you're doing something wrong.

Marchella1983 commented 4 years ago

Okay, thanks for the explanation...

@WanWizard then what do you do with the problem? https://forums.openpli.org/topic/70538-zgemma-h9-combo-4k-hdd-mount-problems-pli-71/

Dima73 commented 4 years ago

Marchella1983

It seems they don’t understand us. Use the HDDsleep plugin as a workaround.

Marchella1983 commented 4 years ago

@Dima73 it needs to be fixed without using HDDsleep plugin, it works for other box manufacturers... HDD sleep should work with the software 1_0_1_697C_1B_FE_2300000_0_0_0_20191105190150

WanWizard commented 4 years ago

@WanWizard then what do you do with the problem? https://forums.openpli.org/topic/70538-zgemma-h9-combo-4k-hdd-mount-problems-pli-71/

What problem exactly? That is is mounted as USB? OpenPLi doesn't care where it is mounted, it will simply use it. And nether do I. If you want a specific mount point, you can define one in fstab, or you can label it so OpenPLi mounts it where you want.

If the problem is "OpenPLi doesn't put the disk in sleep because it is seen as removable", than that problem needs to be solved, not the fact it is flagged as removable.

BTW: it wouldn't suprise me that the reason it's seen as USB and removable is that the disk isn't connected to the SATA bus at all, but to the USB bus using a SATA-to-USB chip, effectively a built-in USB disk enclosure. And it therefore suffers from the same issues some other USB disks have.

BTW2: I have an ST1500LM in a USB enclosure connected to my box, and it goes into standby just fine. So it is not a generic problem.

Marchella1983 commented 4 years ago

If the problem is "OpenPLi doesn't put the disk in sleep because it is seen as removable", than that problem needs to be solved, not the fact it is flagged as removable.

and that's what the dialogue is about, we need to fix the Sleep HDD...

and how it will be marked detachable or not is up to you to decide...

Marchella1983 commented 4 years ago

my 1GB HDD is also defined with the 0 flag, so I think you're wrong, and you need to make the HDD connected over Sata give the 0 flag Screenshot at 2019-11-05 19-30-08 Screenshot at 2019-11-05 19-29-55 Screenshot at 2019-11-05 19-30-34

WanWizard commented 4 years ago

and how it will be marked detachable or not is up to you to decide...

No, the hardware will determine the value of the removable flag.

WanWizard commented 4 years ago

my 1GB HDD is also defined with the 0 flag, so I think you're wrong, and you need to make the HDD connected over Sata give the 0 flag

The flag is 0 because it is a disk connected to an internal SATA port, and not hot-swapable.

In the H9, the flag is 1 because it is a disk connected to an internal USB bus via a SATA-to-USB chip, so it is seen by the OS as a USB device. This can only be fixed by a new hardware design, and I don't think Zgemma will be up for that. :smile:

Point remains that this is irelevant when it comes to sleep mode. Either this specific SATA-to-USB chip doesn't support it, in which case end of discussion, or it does, but different from SATA connected disks, in which case OpenPLi needs to add sleep support for USB disks to the image. In which case the question is "what does the HDD sleep plugin different from OpenPLi"?

Marchella1983 commented 4 years ago

The flag is 0 because it is a disk connected to an internal SATA port, and not hot-swapable.

is connected via this usb cable https://58.img.avito.st/640x480/2575749658.jpg it's also considered hot-pluggable.

WanWizard commented 4 years ago

The removable flag really means "you can disconnect this device while the OS is running".

The fact that it is a USB device and you can pull out the cable doesn't imply it is always hot-pluggable. Pull out a FAT formatted USB device, and you'll see it is corrupt.

Anyway, since the discussion is about putting the device to sleep, and not about the flag, I think this issue can be closed, as it is not a zgemma issue.

Dima73 commented 4 years ago

Zgemma H9 Twin/Combo not Sata slot.This simple internal disk 2.5 https://www.youtube.com/watch?v=S514uXKyNYg

zgemma-star commented 4 years ago

The Hisilicon has shared GPIO function for the SATA/PCI/USB3.0 It's not USB to Sata as suggest but a sata3 slot.

When Sata is "Hotplug-capable" then the flag removable is set as 1 from kernel 4.4 and newer. When a user doesn't want this then can ugly recommit the linux patch or set rules.

WanWizard commented 4 years ago

Ok.

Doesn't change anything to the above, the disk is hot swapable, therefore the removable flag is correctly set to 1. :smile:

Marchella1983 commented 4 years ago

it's not right, HDD disk should have the flag 0, even you screenshots with installed UBUNTU that is also linux, in place to fool the head better fixed this error.

if it's a problem for Zgemma, then have him write that it's a problem...

who and how the user should decide...

it's idiotic to take out an HDD every day...

I also have two Twins, one of which is v1, and Combo where the HDD is installed under the lid, and this is also what you think Hotplug-capable?

WanWizard commented 4 years ago

My last response here, because you don't seem to get it:

Marchella1983 commented 4 years ago

@zgemma-star please if possible then make the HDD sda flag 0, all other models manufacturers use this...

WanWizard commented 4 years ago

I sure hope they don't, as it is removable?

Marchella1983 commented 4 years ago

@WanWizard to argue with you no more, I repeat, it must be up to the user to decide what suits him and what does not...

Just make the HDD you want to connect via Sata not removable, that's all we ask you to do now...

I'm not that stupid and I don't have a lot of money to take my HDD out on hot, I always blame my boxing...

Marchella1983 commented 4 years ago

If it's an external hard drive (USB HDD) like this one, then yes I agree with you this can be called hot-pluggable, but if it's an external hard drive like this 01_b_34

but if it's internal like this. 8442fd953ef273ee57b78a57e5b2a19f92d7bab1

it's not hot-pluggable.

Dima73 commented 4 years ago

What kind of fool, excuse me, will pull a disk out of the receiver's body while watching TV?

WanWizard commented 4 years ago

@Dima73 agreed, but that is not the point.

@Marchella1983 You don't seem to get the concept. Start by reading https://en.wikipedia.org/wiki/Hot_swapping. The key here is "depending upon the supplier such devices are characterized as hot-swappable or hot-pluggable".

USB disks are NEVER hot swappable. You need to unmount and "disconnect" them before you can safely unplug them. That is true in Linux, and true in Windows. SATA disks are designed to support hot-swapping, but whether or not they are depends on the way they are pysically mounted. Caddy systems like this one, like Synology disks, like most rackmount server disks, are all marked as removable. Because from a technical point of view they are.

Which is why my Seagate 2,5" 1TB USB disk has removable "0", and my 3,5" Hitachi 4TB NAS disk has removable "1".

And again, using the removable flag in software for ANY OTHER PURPOSE than this is wrong. Using it as a USB device indicator is wrong. Using it to determine whether you need SCSI or ATA commands to control the device is wrong.

Marchella1983 commented 4 years ago

@WanWizard, what is it that bothers you so much if it is with flag 0 that it will interfere with OpenPli's work, or what?

Is it really so critical or difficult to do because we ask for it, because all manufacturers who have internal HDD support with this flag, regardless of whether it is removable or not...

Marchella1983 commented 4 years ago

maybe I want to connect a hard drive to the Zgemma and it'll be hot-pluggable with flag 1?

As far as I know, the hard disk drive must not be connected to a hot one because the Q114 control field transistor in the power supply circuit of the hard disk drive burns down immediately... images

WanWizard commented 4 years ago

What bothers me is that you ask a manufacturer to change something because you don't understand it, and possible mis-use its purpose. Which means you are not solving root-cause issues, you are attempting to circumvent or workaround your own mistakes.

The reason this harddisk doesn't go to sleep in OpenPLi has the same cause. Someone in the past has interpreted "removable" as "it is a USB device", which is wrong. Which means OpenPLi has to fix this to make it work again, not zgemma !

Dima73 commented 4 years ago

@WanWizard openPli need fix

1)mdev-mount.sh removable=cat /sys/block/$DEVBASE/removable readlink -fn /sys/block/$DEVBASE/device | grep -qs 'pci|ahci|sata' external=$? if [ "${removable}" -eq "0" -a "${external}" -eq "0" ]; then

we assume it's the internal harddisk

            devicetype="hdd"

So --> mount device as hdd need removable 0 and name 'pci or ahci or sata' is /sys/block/$DEVBASE/device

Most likely so: if [ "${external}" -eq "0" ]; then

we assume it's the internal harddisk

            devicetype="hdd"

2)Harddisk.py -if not removable and not self.card: +if self.internal and not self.card: self.startIdle()

WanWizard commented 4 years ago

Yes, probably in more places, as the assumptions made at the time were wrong.

Marchella1983 commented 4 years ago

@zgemma-star I think it would be right to write a 2.5" Sata3 Hot-Plugable SSD/HDD in the specification...

and there won't be any arguments about it...

zgemma-star commented 4 years ago

We hope image makers will ignore removable flag for internal disks and check only if the device is an ahci/sata disks.

WanWizard commented 4 years ago

OpenPLi has already made a few changes, the rest is on its way. (thanks @Dima73)