Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #261636

Re: using ddrescue on the root partition - boot with / as read-only

From Vincent Lefevre <vincent@vinc17.net>
Newsgroups linux.debian.user
Subject Re: using ddrescue on the root partition - boot with / as read-only
Date 2023-09-13 16:00 +0200
Message-ID <Hdyzn-8IPa-3@gated-at.bofh.it> (permalink)
References <HdwQV-8I0j-1@gated-at.bofh.it> <Hdx0C-8I3x-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 2023-09-13 14:15:30 +0200, tomas@tuxteam.de wrote:
> On Wed, Sep 13, 2023 at 01:54:04PM +0200, Vincent Lefevre wrote:
> > I need to use ddrescue on the root partition of my laptop.
> > 
> > So I need to have the root partition mounted in read-only mode.

BTW, in recovery mode, it is systemd that remounts the partition in rw
mode. From the "journalctl -b" output:

Sep 13 13:20:13 zira kernel: EXT4-fs (dm-2): mounted filesystem fb1e7272-f798-4ae9-a53b-e62e3139e239 ro with ordered data mode. Quota mode: none.

so this is initially "ro" as wanted. But later:

Sep 13 13:20:14 zira systemd[1]: Starting systemd-remount-fs.service - Remount Root and Kernel File Systems...
Sep 13 13:20:14 zira kernel: EXT4-fs (dm-2): re-mounted fb1e7272-f798-4ae9-a53b-e62e3139e239 r/w. Quota mode: none.

> > How can I do that?
> 
> In roughly ascending order of comfort (but also of "external tools
> needed"):
> 
>  - break out in the initramfs, before root is pivoted to
>    your customary root partition. At this point your system
>    is running on the loaded initramfs (enter 'break=pre-mount'
>    at the grub command line ** NOTE: please, double check this,
>    it's from memory!)

I suppose that it would be better to break after the mount
(break=mountroot or perhaps bottom or init): so the root partition
would already be mounted in read-only mode (otherwise, since this
is an encrypted partition, it would be more complex).

But this would also mean that I would have to run ddrescue from
the initramfs.

Or perhaps I could use /bin/sh as init, so that systemd (and its
remount as rw) would be avoided?

>  - use a "live" OS (either explicitly built for that, like
>    Knoppix,

If I could install it on the disk used for the backup (there is enough
space) and boot from the USB drive, this could be a solution.

> or, e.g. Debian's "rescue" mode)

I suppose that this is what is actually called "recovery mode"
in GRUB. But I suppose that I would need to add init=/bin/sh
to avoid systemd (see above).

>  - extract the disk and put it (perhaps in a USB case) into
>    another computer

Not really possible for me (except if everything else fails).

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

using ddrescue on the root partition - boot with / as read-only Vincent Lefevre <vincent@vinc17.net> - 2023-09-13 14:10 +0200
  Re: using ddrescue on the root partition - boot with / as read-only <tomas@tuxteam.de> - 2023-09-13 14:20 +0200
    Re: using ddrescue on the root partition - boot with / as read-only tomas@tuxteam.de - 2023-09-13 14:30 +0200
    Re: using ddrescue on the root partition - boot with / as read-only Vincent Lefevre <vincent@vinc17.net> - 2023-09-13 16:00 +0200
      Re: using ddrescue on the root partition - boot with / as read-only Stefan Monnier <monnier@iro.umontreal.ca> - 2023-09-14 05:10 +0200
        Re: using ddrescue on the root partition - boot with / as read-only Vincent Lefevre <vincent@vinc17.net> - 2023-09-14 11:30 +0200
          Re: using ddrescue on the root partition - boot with / as read-only Stefan Monnier <monnier@iro.umontreal.ca> - 2023-09-14 18:10 +0200
  Re: using ddrescue on the root partition - boot with / as read-only David Christensen <dpchrist@holgerdanske.com> - 2023-09-14 06:00 +0200
    Re: using ddrescue on the root partition - boot with / as read-only Vincent Lefevre <vincent@vinc17.net> - 2023-09-14 12:20 +0200
      Re: using ddrescue on the root partition - boot with / as read-only Michael Kjörling <2695bd53d63c@ewoof.net> - 2023-09-14 14:50 +0200
        Re: using ddrescue on the root partition - boot with / as read-only Max Nikulin <manikulin@gmail.com> - 2023-09-14 16:50 +0200
          Re: using ddrescue on the root partition - boot with / as read-only Vincent Lefevre <vincent@vinc17.net> - 2023-09-14 17:40 +0200
      Re: using ddrescue on the root partition - boot with / as read-only David Christensen <dpchrist@holgerdanske.com> - 2023-09-15 07:30 +0200
        Re: using ddrescue on the root partition - boot with / as read-only Vincent Lefevre <vincent@vinc17.net> - 2023-09-15 14:50 +0200
          Re: using ddrescue on the root partition - boot with / as read-only David Christensen <dpchrist@holgerdanske.com> - 2023-09-15 23:00 +0200

csiph-web