Hi, > Am 01.03.2018 um 19:01 schrieb Andreas Kemnade <andr...@kemnade.info>: > > On Thu, 1 Mar 2018 18:48:30 +0100 > "H. Nikolaus Schaller" <h...@goldelico.com> wrote: > >>> >>> Accessing "/dev/sdc<x>" is completely wrong and luckily I had no "/dev/sdc" >>> that could be erased! The same is true for "/media/P<x>"! >> >> Well, it is impossible to perfectly prevent erasing the wrong device, >> because only the user can know what the SD card reader with an SD really is. >> So it is equally risky as calling fdisk directly. >> > No, > if you call fdisk you see what disk you use. > Here Sven thought, makesd would access /dev/sdg > but did access /dev/sdc! > > That is a different thing. > fdisk does not do any writes when it is called without a device name to > work on!
Yes, it does not write automatically. But you still can destroy a device without noticing if you *assume* (e.g. after a long and exhausting day) you have chosen the right one. Run fdisk /dev/sdc (instead of sdg), delete a partition and issue the w command... There is also no warning that you have chosen the wrong device. The only difference is that you might easier notice it (if you recognize it from the existing partition table) before typing "w". > makesd does. > > Sven's sudo construction is just equal to calling > makesd *without* DEV set!!! Yes. He might have had to prefix the full command with sudo. > > In that case makesd should not take a predefined device. Agreed. As written in the other mail, there is an optional predefined value that does not need the DEV= mechanism and must be set manually. So we can assume that the user knows what he is doing. > > Maybe makesd also should display a list what it wants to do > asking for final confirmation No, that is a barrier for easy useage. The best would be some command line tool to locate the external SD card reader on any system. But this does not and will never exist. Systems can have more than one SD reader... And sometimes it is not possible to detect if it is an SD reader or not. Or someone really wants to format an external hard disk with makesd. So it is impossible to automate the choice of the device. Still a default is better than asking for a confirmation each time. > > The best thing would be to call makesd from NAND with a graphical > interface. Indeed. If someone wants to write that in a generic enough way so that it runs also on the other Letux-OS supported devices. Including those without display ;) Looks like a big challenge... > > >> There is at least one protection: you can't overwrite /dev/sda. >> >> What you could do is to just sudo chmod o+rw /dev/your-sd-reader >> but I am not sure what happens with newly created partitions. >> > No, that would not work, because you want to mount the device and > create device nodes on it, which would require root privileges again. Which is what I assumed. That you must run it as root anyways. BR, Nikolaus
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ Gta04-owner mailing list Gta04-owner@goldelico.com http://lists.goldelico.com/mailman/listinfo.cgi/gta04-owner