public inbox for dm-crypt@saout.de
 help / color / mirror / Atom feed
From: Arno Wagner <arno@wagner.name>
To: dm-crypt@saout.de
Subject: Re: [dm-crypt] Recover from Spontaneous Ejection
Date: Wed, 20 Jan 2021 17:54:22 +0100	[thread overview]
Message-ID: <20210120165422.GA13151@tansi.org> (raw)
In-Reply-To: <trinity-8873a400-bf43-4eb9-928d-c54fa21b9694-1611140784417@3c-app-mailcom-bs12>

You may run into the issue where that SD cards (like SSDs) may
actually use larger block-sizes than exposed at the interface.
Hence interrupting a write may damage parts that were not 
requested to be written.

SSDs have that mostly under control now, I think, probably by
adding some more complex commit schemes. But SD cards have 
far less comuting power and may not do that.

Regards,
Arno



On Wed, Jan 20, 2021 at 12:06:24 CET, Frederick Gotham wrote:
> 
>    I'm developing a product running embedded Linux.
> 
>    We have an SDcard with one partition on it, and this partition is an
>    encrypted LUKS volume.
> 
>    While the SDcard is mounted, the user can spontaneously eject the
>    SDcard. I have successfully altered the UDEV script to handle this
>    eventuality, as follows:
> 
>        umount /mnt/sdcard
>        cryptsetup luksClose cryptocard
> 
>    Then when the user re-inserts the SDcard after a spontaneous ejection,
>    I try to re-mount it again. So the entire process from start to finish
>    goes as follows:
> 
>        echo -n password | cryptsetup luksOpen /dev/sdb1 cryptocard -
>        mount /dev/mapper/cryptocard /mnt/sdcard
>        [ User spontaneously ejects SDcard  ]
>        umount /mnt/sdcard
>        cryptsetup luksClose cryptocard
>        [ ... ... ... 1 minute goes by ... ... ... ]
>        [         User re-inserts SD card         ]
>        echo -n password | cryptsetup luksOpen /dev/sdb1 cryptocard -
>        mount /dev/mapper/cryptocard /mnt/sdcard
> 
>    This appears to work just fine, however when I try to do more complex
>    write operations, it starts to freak out a little (files that were
>    previously visible are no longer visible). When I reboot the machine,
>    everything's working fine again.
> 
>    So it seems that the system is not adequately recovering from the
>    spontaneous ejection of the SDcard. Do I need to somehow "flush out"
>    the LUKS system in order to successfully re-mount the volume? Is it
>    possible to 'restart' the LUKS subsystem to get this to work properly
>    again? I only ever have one LUKS volume open at a time so I don't have
>    to worry about closing other volumes before 'flushing out'.
> 
>    Frederick

> _______________________________________________
> dm-crypt mailing list
> dm-crypt@saout.de
> https://www.saout.de/mailman/listinfo/dm-crypt


-- 
Arno Wagner,     Dr. sc. techn., Dipl. Inform.,    Email: arno@wagner.name
GnuPG: ID: CB5D9718  FP: 12D6 C03B 1B30 33BB 13CF  B774 E35C 5FA1 CB5D 9718
----
A good decision is based on knowledge and not on numbers. -- Plato

If it's in the news, don't worry about it.  The very definition of 
"news" is "something that hardly ever happens." -- Bruce Schneier
_______________________________________________
dm-crypt mailing list
dm-crypt@saout.de
https://www.saout.de/mailman/listinfo/dm-crypt

      parent reply	other threads:[~2021-01-20 16:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-20 11:06 [dm-crypt] Recover from Spontaneous Ejection Frederick Gotham
2021-01-20 11:23 ` Milan Broz
2021-01-20 15:07   ` Frederick Gotham
2021-01-21 22:02     ` [dm-crypt] Fw: " Frederick Gotham
2021-01-20 16:54 ` Arno Wagner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210120165422.GA13151@tansi.org \
    --to=arno@wagner.name \
    --cc=dm-crypt@saout.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox