I have a not-quite-folder not-quite-file on my file system. It is an AWS EC2 instance running Ubuntu 18.04.4 LTS.
I have a script that runs nightly that picks up a file (/ebsvol/dead-drop/sync) and moves it to (/ebsvol/dead-drop/sync) using Robo, which in turn is using Symfony’s Filesystem rename() method (https://symfony.com/doc/current/components/filesystem.html#rename).
const CANARY_PATH = '/ebsvol/dead-drop/sync'; const CANARY_WORKING_PATH = '/ebsvol/dead-drop/~sync'; ... $this->taskFilesystemStack() ->rename(self::CANARY_PATH, self::CANARY_WORKING_PATH) ->run();
Something is going awry in the script or with this code, though that’s not really why I’m here. The result and cleanup is why I’m here. 🙂
The result is that the ~sync “file” is created, however it is actually… a hard link to /bin? This is where things get fishy. My
ls -ial looks like this:
3276803 -rw-rw-r-- 1 configbot configbot 125 Jul 4 00:30 '~sync'
So it’s just a text file, so let’s try cat…
$ cat ~sync cat: /bin: Is a directory
$ cd ~sync
…changes my prompt to /bin, and doing an ls, it’s surely bin. Incidentally,
ls -ial on my root volume shows that /bin is iNode 12.
This has happened to me once in the past, and I just did
rm -rf ~sync which hosed my entire server and I had to rebuild. So I’m trying to avoid that.
How do I get rid of this weird ~sync file/folder/symlink/hardlink without trashing /bin?
Some additional info:
/ebsvolis a separate EBS volume than
/(i.e. separate hard drives/partitions!)
- I think if it’s a hard link in some weird way,
rm ~syncmight work. But wouldn’t it show identical iNode numbers?
- I will take a snapshot of both volumes before I attempt anything. 🙂