縮小失敗後に暗号化されたLUKSパーティションを保存する方法

縮小失敗後に暗号化されたLUKSパーティションを保存する方法

Samsung T7 1TB USBドライブに暗号化されたext4パーティションがあります。 LUKS(LUKSコンテナと呼ぶことができますか?)で、パーティションは850GBです。約130GB程度使用しています。また、未割り当て領域が非常に少ない暗号化されていない100 GB NTFSパーティションもあります。

100GB NTFSパーティションを300GB拡張できるように、KDEパーティションマネージャを使用して暗号化されたパーティションを550GBに縮小してみました。両方のタスクを設定して[適用]をクリックしました。作業が開始され、数分間続きました(ただし進行状況はありません)。その後、エラーが原因でジョブが失敗したことを報告します。愚かなことに、私はエラーログを保存しませんでした。その理由は、私が知っている限り、エラーの詳細や原因が提供されておらず、変更がないと仮定したためです。ただし、この暗号化された850GB ext4パーティションはDolphinおよびKDE Partition Managerに表示されますが、マウントできなくなります。ドライブを接続すると、ドライブが正しく認識され、システムがドライブを認識できるようにするように求められたパスワードが事前に入力されたパスワードプロンプトが表示されます(問題がある場合に備えてこのパスワードを再入力してみました)。 。 NTFSパーティションがまったく表示されないようです。

KDEパーティションマネージャで保存されていないログには、ジョブの発生に伴う進捗状況も表示されていると思います。最初の作業は、最初にext4パーティションを少量(0.04GB)だけ縮小したと思います。私は間違って覚えていませんでした。元のサイズが830.08GBであるとしましょう。最初の作業はこれを830.04GBに減らすことであり、成功すると思います。これらのディメンションまたは.04ディメンションを事実として受け入れないでください。それは私が覚えているだけです。

Dolphinのエラーメッセージは次のとおりです。

「830.0 GiB暗号化ドライブ」へのアクセス中にエラーが発生しました。システムの応答:要求されたジョブが失敗しました。 /media/wesley/WG-T7-Eで/dev/dm-1マウントエラー:無効なfsタイプ、無効なオプション、無効な/dev /mapper/luks-5c9cfaa5-0576-4b47-8e65-05f7d8b52d39のスーパーブロック、コードページまたはヘルパーの欠落または他のエラー。

KDE Partition Managerはパーティションと未割り当てスペースの両方を見ることができ、サイズと使用済みスペースが正しく報告されます(または私が知っているように、十分に近いです。つまり、リストで選択した新しいサイズを使用しません)。

KDE Partition Manager の暗号化パーティション (/dev/sdb1) の属性は次のとおりです。

Label: WG-T7-E (which is correct)
Mount point: (none found)
Partition type: primary
Status: idle
UUID: 9ffc3bef-5df8-4dd5-b4de-d2ff45aa6322
Partition Label: (none)
Partition UUID: 75E6E7E1-FA4F-0F40-BAB4-85F5F4A5BD30
Size: 830.04 GiB
Available: 84% - 699.21 GiB
Used: 16% - 130.83 GiB
First sector: 2,048
Last sector: 1,740,728,319
Number of sectors: 1,740,726,272
Flags: bios-grub and boot checkboxes shown, but neither checked.

KDEパーティションマネージャの未割り当て領域の属性は次のとおりです。

Label:
Mount point: (none found)
Partition type: unallocated
Status: idle
Partition Label: (none)
Partition UUID: (none)
Size: 36.00MiB
First sector: 1,740,728,320
Last sector: 1,740,802,047
Number of sectors: 73,728

KDE Partition Managerの暗号化されていないパーティション(/ dev / sdb2)の属性は次のとおりです。

File system: ntfs
Label: WG-T7-U (which is correct)
Mount point: /media/wesley/WG-T7-U
Partition type: primary
Status: idle
UUID: 05DBF9124869C198
Partition Label: (none)
Partition UUID: 8CC612F8-30FA-6449-8FA2-754C82E8B0C3
Size: 101.43 GiB
Available: 99% - 101.37 GiB
Used: 1% - 67.61 MiB
First sector: 1,740,802,048
Last sector: 1,953,523,711
Number of sectors: 212,721,664
Flags: bios-grub and boot checkboxes shown, but neither checked.

USBドライブを挿入し、パスワードdmesgを入力した後:

[ 6049.158336] usb 2-4: new SuperSpeed USB device number 8 using xhci_hcd
[ 6049.171380] usb 2-4: New USB device found, idVendor=04e8, idProduct=61fb, bcdDevice= 1.00
[ 6049.171394] usb 2-4: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[ 6049.171400] usb 2-4: Product: PSSD T7 Shield
[ 6049.171405] usb 2-4: Manufacturer: Samsung
[ 6049.171409] usb 2-4: SerialNumber: S6YJNS0TA00012H
[ 6049.180592] scsi host2: uas
[ 6049.181476] scsi 2:0:0:0: Direct-Access     Samsung  PSSD T7 Shield   0    PQ: 0 ANSI: 6
[ 6049.182964] sd 2:0:0:0: Attached scsi generic sg2 type 0
[ 6049.183565] sd 2:0:0:0: [sdb] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB)
[ 6049.183710] sd 2:0:0:0: [sdb] Write Protect is off
[ 6049.183717] sd 2:0:0:0: [sdb] Mode Sense: 43 00 00 00
[ 6049.183951] sd 2:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 6049.184282] sd 2:0:0:0: [sdb] Optimal transfer size 33553920 bytes
[ 6049.207124]  sdb: sdb1 sdb2
[ 6049.208449] sd 2:0:0:0: [sdb] Attached SCSI disk
[ 6049.430150] audit: type=1107 audit(1708641903.652:169): pid=1274 uid=102 auid=4294967295 ses=4294967295 subj=unconfined msg='apparmor="DENIED" operation="dbus_signal"  bus="system" path="/org/freedesktop/login1" interface="org.freedesktop.DBus.Properties" member="PropertiesChanged" name=":1.2" mask="receive" pid=2912 label="snap.firefox.firefox" peer_pid=1318 peer_label="unconfined"
                exe="/usr/bin/dbus-daemon" sauid=102 hostname=? addr=? terminal=?'
[ 6049.430683] ntfs3: Unknown parameter 'windows_names'
[ 6049.494120] audit: type=1107 audit(1708641903.716:170): pid=1274 uid=102 auid=4294967295 ses=4294967295 subj=unconfined msg='apparmor="DENIED" operation="dbus_signal"  bus="system" path="/org/freedesktop/login1" interface="org.freedesktop.DBus.Properties" member="PropertiesChanged" name=":1.2" mask="receive" pid=2912 label="snap.firefox.firefox" peer_pid=1318 peer_label="unconfined"
                exe="/usr/bin/dbus-daemon" sauid=102 hostname=? addr=? terminal=?'
[ 6052.079215] audit: type=1107 audit(1708641906.301:171): pid=1274 uid=102 auid=4294967295 ses=4294967295 subj=unconfined msg='apparmor="DENIED" operation="dbus_signal"  bus="system" path="/org/freedesktop/login1" interface="org.freedesktop.DBus.Properties" member="PropertiesChanged" name=":1.2" mask="receive" pid=2912 label="snap.firefox.firefox" peer_pid=1318 peer_label="unconfined"
                exe="/usr/bin/dbus-daemon" sauid=102 hostname=? addr=? terminal=?'
[ 6054.523583] audit: type=1107 audit(1708641908.745:172): pid=1274 uid=102 auid=4294967295 ses=4294967295 subj=unconfined msg='apparmor="DENIED" operation="dbus_signal"  bus="system" path="/org/freedesktop/login1" interface="org.freedesktop.DBus.Properties" member="PropertiesChanged" name=":1.2" mask="receive" pid=2912 label="snap.firefox.firefox" peer_pid=1318 peer_label="unconfined"
                exe="/usr/bin/dbus-daemon" sauid=102 hostname=? addr=? terminal=?'
[ 6054.598701] audit: type=1107 audit(1708641908.820:173): pid=1274 uid=102 auid=4294967295 ses=4294967295 subj=unconfined msg='apparmor="DENIED" operation="dbus_signal"  bus="system" path="/org/freedesktop/login1" interface="org.freedesktop.DBus.Properties" member="PropertiesChanged" name=":1.2" mask="receive" pid=2912 label="snap.firefox.firefox" peer_pid=1318 peer_label="unconfined"
                exe="/usr/bin/dbus-daemon" sauid=102 hostname=? addr=? terminal=?'
[ 6054.599943] EXT4-fs (dm-1): bad geometry: block count 217599488 exceeds size of device (217590272 blocks)
[ 6054.600795] audit: type=1107 audit(1708641908.822:174): pid=1274 uid=102 auid=4294967295 ses=4294967295 subj=unconfined msg='apparmor="DENIED" operation="dbus_signal"  bus="system" path="/org/freedesktop/login1" interface="org.freedesktop.DBus.Properties" member="PropertiesChanged" name=":1.2" mask="receive" pid=2912 label="snap.firefox.firefox" peer_pid=1318 peer_label="unconfined"
                exe="/usr/bin/dbus-daemon" sauid=102 hostname=? addr=? terminal=?'
[ 6054.798116] audit: type=1107 audit(1708641909.020:175): pid=1274 uid=102 auid=4294967295 ses=4294967295 subj=unconfined msg='apparmor="DENIED" operation="dbus_signal"  bus="system" path="/org/freedesktop/login1" interface="org.freedesktop.DBus.Properties" member="PropertiesChanged" name=":1.2" mask="receive" pid=2912 label="snap.firefox.firefox" peer_pid=1318 peer_label="unconfined"
                exe="/usr/bin/dbus-daemon" sauid=102 hostname=? addr=? terminal=?'
[ 6054.804803] EXT4-fs (dm-1): bad geometry: block count 217599488 exceeds size of device (217590272 blocks)
[ 6054.809500] audit: type=1107 audit(1708641909.031:176): pid=1274 uid=102 auid=4294967295 ses=4294967295 subj=unconfined msg='apparmor="DENIED" operation="dbus_signal"  bus="system" path="/org/freedesktop/login1" interface="org.freedesktop.DBus.Properties" member="PropertiesChanged" name=":1.2" mask="receive" pid=2912 label="snap.firefox.firefox" peer_pid=1318 peer_label="unconfined"
                exe="/usr/bin/dbus-daemon" sauid=102 hostname=? addr=? terminal=?'

この損失を正常に回復するのに役立つ人に金銭的報酬を提供するか、人々に金銭的報酬を配分してください。ありがとうございます。

ベストアンサー1

要約すると、パーティションのサイズ変更後に次のインストールエラーが発生します。

無効なファイルシステムタイプ、無効なオプション、/dev/mapper/luks-5c9cfaa5-0576-4b47-8e65-05f7d8b52d39のスーパーブロックエラー、コードページ、ヘルパーの欠落、またはその他のエラー。

これまでは、LUKSヘッダ自体には何の問題もないことを意味します。

によると、dmesg実際のエラーメッセージは次のとおりです。

EXT4-fs(dm-1):ジオメトリエラー:ブロック数217599488がデバイスサイズ(217590272ブロック)を超えています。

これはファイルシステムを最初に縮小せずにパーティションを縮小する標準的なケースのように見えます。その違いはわずか数千のデータブロック(9216 4Kブロック= 73728 512バイトセクタ)です。

パーティションテーブルに必要な未割り当て領域があるようです。

Partition Managerの出力に基づいて、おおよそparted次のようになります。

# parted /dev/sdb unit s print free
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start        End          Size         File system  Name  Flags
        34s          2047s        2014s        Free Space
 1      2048s        1740728319s  1740726272s               luks
        1740728320s  1740802047s  73728s       Free Space
 2      1740802048s  1953523711s  212721664s                ntfs

パーティション番号、名前、フラグは異なる場合があります。開始サイズと終了サイズが一致する必要があります。すべての仮定が正しい場合は、パーティション1の背後にある空き領域を回収することが解決策です。

まず、LUKSコンテナを閉じる必要があります。ドライブのマウント解除、パーティションテーブルの再読み込みに失敗または再起動できます。

# cryptsetup close luks-5c9cfaa5-0576-4b47-8e65-05f7d8b52d39
# umount /dev/sdb*

パーティション表に未割り当てスペースがあるため、partedのresizepartコマンドを使用してそれらを回復できます。

# parted /dev/sdb resizepart 1 1740802047s

これはデータではなくパーティションテーブルのみを変更します。

運が良ければ、後でファイルシステムが正常に動作します。

おすすめ記事