incapaz de remover links simbólicos da cópia rsync de / bin e / dev

1

Eu acidentalmente fiz uma cópia rsync do meu diretório raiz, "/" usando a opção -a, como segue:

user@mycomputer:~$ rsync -a / /backup-dir
user@mycomputer:~$ ls -l /backup-dir/
total 10102784
drwxrwxrwx 1 user nogroup         0 Feb  3 18:18 bin
drwxrwxrwx 1 user nogroup         0 Feb  3 18:21 dev

Não consigo apagar / backup-dir / bin e / backup-dir / dev ou qualquer um dos arquivos individuais devido a um problema com a impossibilidade de remover links simbólicos nesses diretórios. (/ backup-dir / bin mostrado abaixo, mesmo para / backup-dir / dev).

user@mycomputer:~$ sudo rm -rf /backup-dir/bin
rm: cannot remove ‘/backup-dir/bin’: Directory not empty
user@mycomputer:~$ ls -l /backup-dir/bin
total 16384
lr-xr-xr-x 1 user root 22 Feb  3 16:11 bzcmp -> bzdiff
lr-xr-xr-x 1 user root 22 Feb  3 16:11 bzegrep -> bzgrep
lr-xr-xr-x 1 user root 22 Feb  3 16:11 bzfgrep -> bzgrep
lr-xr-xr-x 1 user root 22 Feb  3 16:11 bzless -> bzmore
lr-xr-xr-x 1 user root 26 Feb  3 16:11 dnsdomainname -> hostname
lr-xr-xr-x 1 user root 26 Feb  3 16:11 domainname -> hostname
lr-xr-xr-x 1 user root 26 Feb  3 16:11 lessfile -> lesspipe
lr-xr-xr-x 1 user root 18 Feb  3 16:11 lsmod -> kmod
lr-xr-xr-x 1 user root 26 Feb  3 16:11 nisdomainname -> hostname
lr-xr-xr-x 1 user root 22 Feb  3 16:11 open -> openvt
lr-xr-xr-x 1 user root 18 Feb  3 16:11 rbash -> bash
lr-xr-xr-x 1 user root 18 Feb  3 16:11 rnano -> nano
lr-xr-xr-x 1 user root 18 Feb  3 16:11 sh -> dash
lr-xr-xr-x 1 user root 18 Feb  3 16:11 sh.distrib -> dash
lr-xr-xr-x 1 user root 24 Feb  3 16:11 static-sh -> busybox
lr-xr-xr-x 1 user root 26 Feb  3 16:11 ypdomainname -> hostname
user@mycomputer:~$ sudo rm /backup-dir/bin/bzcmp
user@mycomputer:~$ ls -l /backup-dir/bin
total 16384
lr-xr-xr-x 1 user root 22 Feb  3 16:11 bzcmp -> bzdiff
lr-xr-xr-x 1 user root 22 Feb  3 16:11 bzegrep -> bzgrep
lr-xr-xr-x 1 user root 22 Feb  3 16:11 bzfgrep -> bzgrep
lr-xr-xr-x 1 user root 22 Feb  3 16:11 bzless -> bzmore
lr-xr-xr-x 1 user root 26 Feb  3 16:11 dnsdomainname -> hostname
lr-xr-xr-x 1 user root 26 Feb  3 16:11 domainname -> hostname
lr-xr-xr-x 1 user root 26 Feb  3 16:11 lessfile -> lesspipe
lr-xr-xr-x 1 user root 18 Feb  3 16:11 lsmod -> kmod
lr-xr-xr-x 1 user root 26 Feb  3 16:11 nisdomainname -> hostname
lr-xr-xr-x 1 user root 22 Feb  3 16:11 open -> openvt
lr-xr-xr-x 1 user root 18 Feb  3 16:11 rbash -> bash
lr-xr-xr-x 1 user root 18 Feb  3 16:11 rnano -> nano
lr-xr-xr-x 1 user root 18 Feb  3 16:11 sh -> dash
lr-xr-xr-x 1 user root 18 Feb  3 16:11 sh.distrib -> dash
lr-xr-xr-x 1 user root 24 Feb  3 16:11 static-sh -> busybox
lr-xr-xr-x 1 user root 26 Feb  3 16:11 ypdomainname -> hostname

Eu também não consegui permissões chmod em / backup-dir / bin, caso isso importe.

ATUALIZAÇÃO: Isso me leva na direção certa: link

user@mycomputer:~$ sudo strace rm -f /backup-dir/bin/bzcmp
... (long message, which includes the following)...
unlinkat(AT_FDCWD, "bin/bzcmp", 0)      = 0

As tentativas de unlink dos arquivos não foram bem-sucedidas. O link acima sugere a exclusão por inode. No entanto, quero preservar os inodes dos arquivos originais localizados em / bin. Eu só quero remover os links simbólicos para remover / backup-dir / bin / e / backup-dir / dev /.

Sugestões sobre como remover / backup-dir / bin e / backup-dir / dev são bem-vindas.

    
por bpg 04.02.2016 / 18:06

1 resposta

0

Se nada mais funcionou (estranho) eu sugiro que você use novamente rsync

mkdir empty_dir
sudo rsync -a --delete empty_dir/    /backup-dir/bin/

Fonte:

por 05.02.2016 / 13:57