リモートコンピュータにファイルがあります(正確に誰がそのファイルを作成したのかわからないため)、削除する必要があります。
user@machine:~/folder$ ls
lift_proto.db.lock.db
そして権限は次のとおりです。
user@machine:~/folder$ ls -al
total 12
drwxrwxrwx 2 root root 4096 2012-03-06 20:57 .
drwxr-xr-x 26 user group 4096 2012-03-06 20:53 ..
-rw-r--r-- 1 root root 126 2012-03-06 20:57 lift_proto.db.lock.db
削除してみてください:
user@machine:~/folder$ sudo rm lift_proto.db.lock.db
何の反応もありません:
user@machine:~/folder$ ls
lift_proto.db.lock.db
私は見たその質問、しかしあまり役に立ちません。
user@machine:~/folder$ lsattr
-----------------e- ./lift_proto.db.lock.db
user
また、ファイルの所有権と権限を777に変更しようとしましたが、ファイルを削除しましたが、まだルート所有権と以前の権限に戻りました。
私の最後の推測は、誰かが何とか他の場所でファイルを同期したことです(しかしそれを見る方法はありますか?)。そうでない場合(たとえば、属性などがあるものがあることがわかります)、どのように削除しますか?
アップデート1:
-f
ロゴはrm
問題を解決しません。
アップデート2:stat
出力の前後は次のとおりです。
user@machine:~/folder$ stat lift_proto.db.lock.db
File: `lift_proto.db.lock.db'
Size: 126 Blocks: 8 IO Block: 4096 regular file
Device: 900h/2304d Inode: 20054245 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2012-03-06 21:30:40.600796566 +0400
Modify: 2012-03-06 21:30:40.600796566 +0400
Change: 2012-03-06 21:30:40.600796566 +0400
user@machine:~/folder$ sudo rm -f lift_proto.db.lock.db
user@machine:~/folder$ stat lift_proto.db.lock.db
File: `lift_proto.db.lock.db'
Size: 126 Blocks: 8 IO Block: 4096 regular file
Device: 900h/2304d Inode: 20054245 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2012-03-06 21:32:36.621421452 +0400
Modify: 2012-03-06 21:32:36.621421452 +0400
Change: 2012-03-06 21:32:36.621421452 +0400
アップデート3
トレース出力
user@machine:~/folder$ sudo strace rm -f lift_proto.db.lock.db
execve("/bin/rm", ["rm", "-f", "lift_proto.db.lock.db"], [/* 14 vars */]) = 0
brk(0) = 0x8c9000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc967443000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=42930, ...}) = 0
mmap(NULL, 42930, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc967438000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\355\1\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1572232, ...}) = 0
mmap(NULL, 3680296, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc966ea3000
mprotect(0x7fc96701d000, 2093056, PROT_NONE) = 0
mmap(0x7fc96721c000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x179000) = 0x7fc96721c000
mmap(0x7fc967221000, 18472, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc967221000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc967437000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc967436000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc967435000
arch_prctl(ARCH_SET_FS, 0x7fc967436700) = 0
mprotect(0x7fc96721c000, 16384, PROT_READ) = 0
mprotect(0x60e000, 4096, PROT_READ) = 0
mprotect(0x7fc967445000, 4096, PROT_READ) = 0
munmap(0x7fc967438000, 42930) = 0
brk(0) = 0x8c9000
brk(0x8ea000) = 0x8ea000
open("/usr/lib/locale/locale-archive", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2027984, ...}) = 0
mmap(NULL, 2027984, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc966cb3000
close(3) = 0
open("/usr/share/locale/locale.alias", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2570, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc967442000
read(3, "# Locale name alias data base.\n#"..., 4096) = 2570
read(3, "", 4096) = 0
close(3) = 0
munmap(0x7fc967442000, 4096) = 0
open("/usr/lib/locale/en_US.UTF-8/LC_IDENTIFICATION", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en_US.utf8/LC_IDENTIFICATION", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=373, ...}) = 0
mmap(NULL, 373, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc967442000
close(3) = 0
open("/usr/lib/gconv/gconv-modules.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=26048, ...}) = 0
mmap(NULL, 26048, PROT_READ, MAP_SHARED, 3, 0) = 0x7fc96743b000
close(3) = 0
open("/usr/lib/locale/en_US.UTF-8/LC_MEASUREMENT", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en_US.utf8/LC_MEASUREMENT", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=23, ...}) = 0
mmap(NULL, 23, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc96743a000
close(3) = 0
open("/usr/lib/locale/en_US.UTF-8/LC_TELEPHONE", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en_US.utf8/LC_TELEPHONE", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=59, ...}) = 0
mmap(NULL, 59, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc967439000
close(3) = 0
open("/usr/lib/locale/en_US.UTF-8/LC_ADDRESS", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en_US.utf8/LC_ADDRESS", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=155, ...}) = 0
mmap(NULL, 155, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc967438000
close(3) = 0
open("/usr/lib/locale/en_US.UTF-8/LC_NAME", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en_US.utf8/LC_NAME", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=77, ...}) = 0
mmap(NULL, 77, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc967434000
close(3) = 0
open("/usr/lib/locale/en_US.UTF-8/LC_PAPER", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en_US.utf8/LC_PAPER", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=34, ...}) = 0
mmap(NULL, 34, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc967433000
close(3) = 0
open("/usr/lib/locale/en_US.UTF-8/LC_MESSAGES", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en_US.utf8/LC_MESSAGES", O_RDONLY) = 3
fstat(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
close(3) = 0
open("/usr/lib/locale/en_US.utf8/LC_MESSAGES/SYS_LC_MESSAGES", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=57, ...}) = 0
mmap(NULL, 57, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc967432000
close(3) = 0
open("/usr/lib/locale/en_US.UTF-8/LC_MONETARY", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en_US.utf8/LC_MONETARY", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=286, ...}) = 0
mmap(NULL, 286, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc967431000
close(3) = 0
open("/usr/lib/locale/en_US.UTF-8/LC_COLLATE", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en_US.utf8/LC_COLLATE", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1170770, ...}) = 0
mmap(NULL, 1170770, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc967313000
close(3) = 0
open("/usr/lib/locale/en_US.UTF-8/LC_TIME", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en_US.utf8/LC_TIME", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2454, ...}) = 0
mmap(NULL, 2454, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc967312000
close(3) = 0
open("/usr/lib/locale/en_US.UTF-8/LC_NUMERIC", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en_US.utf8/LC_NUMERIC", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=54, ...}) = 0
mmap(NULL, 54, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc967311000
close(3) = 0
open("/usr/lib/locale/en_US.UTF-8/LC_CTYPE", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en_US.utf8/LC_CTYPE", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=256324, ...}) = 0
mmap(NULL, 256324, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc9672d2000
close(3) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
unlinkat(AT_FDCWD, "lift_proto.db.lock.db", 0) = 0
close(0) = 0
close(1) = 0
close(2) = 0
exit_group(0) = ?
答え1
ファイルは水素2ファイルロック、次から昇降機(Web)ベースのアプリケーション。 H2は興味深いものを使いますファイルロックプロトコル、データベースが使用中の場合、ファイルは直ちに再生成されます。
(ファイル名はフレームワークのデフォルト永続性データベース名と一致します。)
このファイルを削除するには、このデータベースを実行しているすべてのアプリケーションサーバーを停止する必要があります。 (しかし本当に?)
出力strace
には、切断が成功したことが明確に表示されます。
unlinkat(AT_FDCWD, "lift_proto.db.lock.db", 0) = 0
inode番号は再利用可能です。ファイルシステムは希望の割り当て戦略を使用できますが、同じ inode 番号を再割り当てするのを防ぐことはできません。
無料ext3ファイルシステムから:
$ touch a
$ stat -c %i a
593358
$ rm a
$ touch a
$ stat -c %i a
593358
$ touch a b
$ stat -c %i a b
593358
593362
$ rm a b
$ touch b a
$ stat -c %i a b
593362
593358
答え2
inode値を使って削除してみましたか?次のチュートリアルではこれについて説明します。Linuxで空白のファイルを削除する方法
デフォルトでは、次のコマンドを使用してファイルのinodeを取得しますls -il
。 inodeはリストの最初の数字なので、次のものを使用できます。
find . -inum 123456 -exec rm -i {} \;
(123456を経由で見つけたinode番号に置き換えますls -il
。)