/dev/mapper/ 分離、無視、キャンセルの違いは何ですか?

/dev/mapper/ 分離、無視、キャンセルの違いは何ですか?

私はpartedパーティションaを使用しています。後で(参照)を使用してパーティションマップをロードする必要が/dev/mapper/luks_deviceあることを知っています。kpartxこのスレッド)。ただしparted、パーティションの作成中にmkpart swap 1 500通常どおり、次のエラーが発生します。

(parted) mkpart swap 1 500
Error: Partition(s) 1 on /dev/mapper/luks_device have been written, but we have been
unable to inform the kernel of the change, probably because it/they are in use.  As a
result, the old partition(s) will remain in use.  You should reboot now before making
further changes.
Ignore/Cancel? 

何をしますか無視するそしてキャンセル意味は?それらの違いは何ですか? 「キャンセル」を入力してもパーティションは作成され続けます。

ベストアンサー1

Partedは、パーティションテーブルがディスクに書き込まれたとき(そして書き込みが成功したとき)にこの質問をします。したがって、パーティションが存在し、残っている唯一のことは、カーネルにパーティションテーブルを再読み込みするように指示することです。これは単純なシステムコール(BLKRRPART)ですが失敗するので、partedは今その事実だけを知らせることができます。

両者の唯一の違いは無視するそしてキャンセルこの場合、答えは呼び出しが成功を返すかどうかです(選択した場合)。無視する)または選択すると失敗します。キャンセル)。したがって、この質問は戻りコードを確認しないため、対話型モードでは実際には意味がありませんが、バッチモードやparedの代わりにlibpartedを使用する場合は意味があります。

バッチモードでは、選択に応じてコマンドリターンコードが設定されます。

~のため無視する0を返します。

$ sudo parted /dev/sdc rm 1
Warning: Partition /dev/sdc1 is being used. Are you sure you want to continue?
Yes/No? Yes                                                               
Error: Partition(s) 1 on /dev/sdc have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result, the old partition(s) will remain in use.  You
should reboot now before making further changes.
Ignore/Cancel? Ignore                                                     
Information: You may need to update /etc/fstab.

$ echo $?                                              
0

そしてキャンセル1を返します。

$ sudo parted /dev/sdc rm 1
Warning: Partition /dev/sdc1 is being used. Are you sure you want to continue?
Yes/No? Yes                                                               
Error: Partition(s) 1 on /dev/sdc have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result, the old partition(s) will remain in use.  You
should reboot now before making further changes.
Ignore/Cancel? Cancel

$ echo $?
1

行方不明者情報:/ etc / fstabを更新する必要があるかもしれません。やはり明らかな違いがあります。コマンドが失敗したとみなされると、 parted はそのコマンドを印刷しません。

注:上記の例では、同じエラーが発生するために使用されているパーティションを削除しようとしました。状況は異なりますが、動作は同じです。エラーメッセージは、変更をディスクにコミットするために同じlibparted関数から来ます。

おすすめ記事