On 2023-09-13 14:15:30 +0200, to...@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 <vinc...@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)