Message ID | 20240319182026.1571362-7-Quirin.Gylstorff@siemens.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Rework disk encryption | expand |
On 19.03.24 19:18, Quirin Gylstorff wrote: > From: Quirin Gylstorff <quirin.gylstorff@siemens.com> > > This avoids the following error during resizing a file system: > "Error: Success"? Or what should be here? :) > Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> > --- > .../initramfs-crypt-hook/files/encrypt_partition.clevis.script | 1 + > .../initramfs-crypt-hook/files/encrypt_partition.systemd.script | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.clevis.script b/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.clevis.script > index 6e2713f..0bb6720 100644 > --- a/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.clevis.script > +++ b/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.clevis.script > @@ -81,6 +81,7 @@ reencrypt_existing_partition() { > reduced_size="$(expr "$part_size_blocks" - 65536 )" > reduced_size_in_byte="$(expr "$reduced_size" \* 512)" > reduced_size_in_kb="$(expr "$reduced_size_in_byte" / 1024)K" > + e2fsck -f "$1" > if ! resize2fs "$1" "${reduced_size_in_kb}"; then > panic "reencryption of filesystem $1 cannot continue!" > fi > diff --git a/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.systemd.script b/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.systemd.script > index 2e6691a..9809c87 100644 > --- a/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.systemd.script > +++ b/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.systemd.script > @@ -94,6 +94,7 @@ reencrypt_existing_partition() { > reduced_size="$(expr "$part_size_blocks" - 65536 )" > reduced_size_in_byte="$(expr "$reduced_size" \* 512)" > reduced_size_in_kb="$(expr "$reduced_size_in_byte" / 1024)K" > + e2fsck -f "$1" > if ! resize2fs "$1" "${reduced_size_in_kb}"; then > panic "reencryption of filesystem $1 cannot continue!" > fi Jan
On 3/19/24 7:37 PM, Jan Kiszka wrote: > On 19.03.24 19:18, Quirin Gylstorff wrote: >> From: Quirin Gylstorff <quirin.gylstorff@siemens.com> >> >> This avoids the following error during resizing a file system: >> > > "Error: Success"? Or what should be here? :) oops the error message is `Please run ‘e2fsck -f /dev/<disk>’ first`. I had it once so I am not sure it is required. Quirin > >> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> >> --- >> .../initramfs-crypt-hook/files/encrypt_partition.clevis.script | 1 + >> .../initramfs-crypt-hook/files/encrypt_partition.systemd.script | 1 + >> 2 files changed, 2 insertions(+) >> >> diff --git a/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.clevis.script b/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.clevis.script >> index 6e2713f..0bb6720 100644 >> --- a/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.clevis.script >> +++ b/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.clevis.script >> @@ -81,6 +81,7 @@ reencrypt_existing_partition() { >> reduced_size="$(expr "$part_size_blocks" - 65536 )" >> reduced_size_in_byte="$(expr "$reduced_size" \* 512)" >> reduced_size_in_kb="$(expr "$reduced_size_in_byte" / 1024)K" >> + e2fsck -f "$1" >> if ! resize2fs "$1" "${reduced_size_in_kb}"; then >> panic "reencryption of filesystem $1 cannot continue!" >> fi >> diff --git a/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.systemd.script b/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.systemd.script >> index 2e6691a..9809c87 100644 >> --- a/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.systemd.script >> +++ b/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.systemd.script >> @@ -94,6 +94,7 @@ reencrypt_existing_partition() { >> reduced_size="$(expr "$part_size_blocks" - 65536 )" >> reduced_size_in_byte="$(expr "$reduced_size" \* 512)" >> reduced_size_in_kb="$(expr "$reduced_size_in_byte" / 1024)K" >> + e2fsck -f "$1" >> if ! resize2fs "$1" "${reduced_size_in_kb}"; then >> panic "reencryption of filesystem $1 cannot continue!" >> fi > > Jan >
diff --git a/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.clevis.script b/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.clevis.script index 6e2713f..0bb6720 100644 --- a/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.clevis.script +++ b/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.clevis.script @@ -81,6 +81,7 @@ reencrypt_existing_partition() { reduced_size="$(expr "$part_size_blocks" - 65536 )" reduced_size_in_byte="$(expr "$reduced_size" \* 512)" reduced_size_in_kb="$(expr "$reduced_size_in_byte" / 1024)K" + e2fsck -f "$1" if ! resize2fs "$1" "${reduced_size_in_kb}"; then panic "reencryption of filesystem $1 cannot continue!" fi diff --git a/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.systemd.script b/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.systemd.script index 2e6691a..9809c87 100644 --- a/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.systemd.script +++ b/recipes-initramfs/initramfs-crypt-hook/files/encrypt_partition.systemd.script @@ -94,6 +94,7 @@ reencrypt_existing_partition() { reduced_size="$(expr "$part_size_blocks" - 65536 )" reduced_size_in_byte="$(expr "$reduced_size" \* 512)" reduced_size_in_kb="$(expr "$reduced_size_in_byte" / 1024)K" + e2fsck -f "$1" if ! resize2fs "$1" "${reduced_size_in_kb}"; then panic "reencryption of filesystem $1 cannot continue!" fi