@s25_r

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

【linux】rmで消去した重要ファイルを復元したい

解決したいこと

ディレクトリ内ファイルごと「rm -rf ../*」で消去してしまったデータをどうにかして復元させたいです。
調べたところ、extundeleteを使うと復元できるとあったのでいくつかの記事に従い復元を試みていたのですが、どれも途中でエラーが出てしまいわからなくなってしまいます。

・ios
・linux

こちらの記事の

 # wget http://downloads.sourceforge.net/project/extundelete/extundelete/0.2.0/extundelete-0.2.0.tar.bz2"

を打つと下記のように出てしまいます。

発生している問題・エラー

--2021-05-20 09:30:59--  http://downloads.sourceforge.net/project/extundelete/extundelete/0.2.0/extundelete-0.2.0.tar.bz2%0A%0A%0Awget%20http://downloads.sourceforge.net/project/extundelete/extundelete/0.2.0/extundelete-0.2.0.tar.bz2
downloads.sourceforge.net (downloads.sourceforge.net) をDNSに問いあわせています... 216.105.38.13
downloads.sourceforge.net (downloads.sourceforge.net)|216.105.38.13|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 404 Not Found
2021-05-20 09:30:59 エラー 404: Not Found。

下記の記事では下記コマンドでエラーが出ます。

extundeleteをインストールする
 # ./configure --prefix=/tmp/a && make && make install

発生している問題・エラー


Configuring extundelete 0.2.4
Writing generated files to disk
make -s all-recursive
Making all in src
extundelete.cc: 関数 ‘int extundelete_test_inode_bitmap(ext2_filsys, ext2_ino_t)’ 内:
extundelete.cc:196:5: 警告: ‘!’ の被演算子の周りに小括弧を付ける、または ‘&’ から ‘&&’ へ変更する、または ‘!’ から ‘~’ へ変更することを推奨します [-Wparentheses]
  if(! EXT2_SB(fs->super)->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) {
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
extundelete.cc: 関数 ‘ext2_ino_t find_inode(ext2_filsys, ext2_filsys, ext2_inode*, std::__cxx11::string, int)’ 内:
extundelete.cc:1272:29: 警告: narrowing conversion of ‘search_flags’ from ‘int’ to ‘ext2_ino_t {aka unsigned int}’ inside { } -Wnarrowing]
    buf, match_name2, priv, 0};
                             ^
extundelete.cc: 関数 ‘errcode_t restore_file(ext2_filsys, ext2_filsys, const string&)’ 内:
extundelete.cc:1522:3: 警告: this ‘if’ clause does not guard... [-Wmisleading-indentation]
   if (LINUX_S_ISDIR(inode->i_mode) && inode->i_blocks > 0)
   ^~
extundelete.cc:1524:4: 備考: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
    print_directory_inode(fs, inode, ino);
    ^~~~~~~~~~~~~~~~~~~~~
cli.cc: 関数 ‘errcode_t examine_fs(ext2_filsys)’ 内:
cli.cc:337:5: 警告: this ‘if’ clause does not guard... [-Wmisleading-indentation]
     if(strlen(name) > 0)
     ^~
cli.cc:339:6: 備考: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
      if(errcode)  com_err(Config::progname.c_str(), errcode, "while restoring file %s.", name);
      ^~
Making install in src
  /usr/bin/install -c extundelete '/tmp/a/bin'

自分で試したこと

$ mount -o remount,ro /dev/mapper/vg_www-lv_home
mount: /dev/mapper/vg_www-lv_home: マウントポイントが存在しません.

いくつかの記事で見かけた読み取り専用にする、というものもなぜかできません。
マウント先が間違えているのかと思うのですが、どこを読み取り専用にするべきなのかがわからないためどのように書いたらいいのかが分かりません。

$ df -hT
ファイルシス   タイプ   サイズ  使用  残り 使用% マウント位置
devtmpfs       devtmpfs   482M     0  482M    0% /dev
tmpfs          tmpfs      492M     0  492M    0% /dev/shm
tmpfs          tmpfs      492M  496K  492M    1% /run
tmpfs          tmpfs      492M     0  492M    0% /sys/fs/cgroup
/dev/xvda1     xfs        8.0G  2.7G  5.4G   34% /
tmpfs          tmpfs       99M     0   99M    0% /run/user/1000

どれが削除してしまったファイルなのかもわからず路頭に迷っています。

この他にもいろいろなサイトを見て、試してエラーが出ての繰り返しで質問に必要な情報も何を提示していいのかわかっておらず、読みにくくなってしまい申し訳ございません。必要な情報等ありましたら教えていただきたいです。

初心者のため、必要な知識が抜け落ちておりご迷惑をおかけするかと思いますが、どなたかご教授いただけますと幸いです。何卒よろしくお願いいたしますm(_ _)m

0 likes

1Answer

とりあえず順番に,

こちらの記事を参考にトライした部分

 # ./configure --prefix=/tmp/a && make && make install

こちらについては,エラーになっていなそうなので,
/tmp/a/bin/extundelete こちらのコマンドが存在しているか確認して,

# ls /tmp/a/bin/extundelete 
# /tmp/a/bin/extundelete --restore-all --after $(date +%s -d '1 hour ago') /dev/xvda1

こちらをトライすると良いかと思います.

df の結果を見るとデバイス名も同じなので,時刻だけ自分に合わせると同じことができるように見えました.

0Like

Your answer might help someone💌