Dosya sahipliklerini ve izinlerini koruyarak taşımak

Ocak 15th, 2014 § Yorum yok

rsync komutunun -a parametresi ile kullanımı bu iş için uygun görünüyor.
Not1: -a kullanılmadığında izinler korunmamaktadir.
Not2: -a kullanıldığında recursive için -r’ye ihtiyaç yoktur. -a zaten recursivedir.
Genel olarak parametreler:
-v : verbose
-r : recursive copyalama sağlar fakat izinler korunmaz
-a : arşiv modu. Recursive çalışır ve izinleri, sahiplikleri vs korur
-z : dosyaları sıkıştırarak gönderir
-h : human-readable formatta çıktı verir
Örnek:

[root@fatihoz ~]# rsync -azvh --progress /home/fatih/1G.file  /tmp/
sending incremental file list
1G.file
       1.02G 100%   38.46MB/s    0:00:25 (xfer#1, to-check=0/1)

sent 995.86K bytes  received 31 bytes  33.76K bytes/sec
total size is 1.02G  speedup is 1028.22
[root@fatihoz ~]# ls -l /tmp/1G.file 
-rw-rw-r--. 1 fatih fatih 1024000000 Jan 15 05:59 /tmp/1G.file

Not3:recursive kopyalama da eğer dizinide kopyalamak istiyorsak dizin adından sonra “/” konmamalıdır.

Dizin içeriğini taşımak için:

[root@fatihoz ~]# rsync -azvh --progress deneme/  /tmp/
sending incremental file list
./
1.txt
           0 100%    0.00kB/s    0:00:00 (xfer#1, to-check=3/5)
12233434543.txt
           0 100%    0.00kB/s    0:00:00 (xfer#2, to-check=2/5)
122343.txt
           0 100%    0.00kB/s    0:00:00 (xfer#3, to-check=1/5)
123.txt
           0 100%    0.00kB/s    0:00:00 (xfer#4, to-check=0/5)

sent 246 bytes  received 91 bytes  674.00 bytes/sec
total size is 0  speedup is 0.00
[root@fatihoz ~]# ls /tmp/
12233434543.txt       .ICE-unix/            .vbox-root-ipc/
122343.txt            keyring-laEwp7/       virtual-fatih.1zDlF2/
123.txt               orbit-fatih/          virtual-fatih.VRdNGR/
1G.file               orbit-gdm/            virtual-fatih.XuZfls/
1.txt                 pulse-Z1C3D8mISpLD/   .X0-lock
.esd-500/             .vbox-fatih-ipc/      .X11-unix/

Dizini de taşımak için

 
[root@fatihoz ~]# rsync -azvh --progress deneme  /tmp/
sending incremental file list
deneme/
deneme/1.txt
           0 100%    0.00kB/s    0:00:00 (xfer#1, to-check=3/5)
deneme/12233434543.txt
           0 100%    0.00kB/s    0:00:00 (xfer#2, to-check=2/5)
deneme/122343.txt
           0 100%    0.00kB/s    0:00:00 (xfer#3, to-check=1/5)
deneme/123.txt
           0 100%    0.00kB/s    0:00:00 (xfer#4, to-check=0/5)

sent 261 bytes  received 92 bytes  706.00 bytes/sec
total size is 0  speedup is 0.00
[root@fatihoz ~]# ls /tmp/deneme/
12233434543.txt  122343.txt  123.txt  1.txt

Uzakdaki bilgisayara dosya göndermek için:

[root@fatihoz ~]# rsync -avh --progress /home/fatih/1G.file  root@localhost:/tmp/
The authenticity of host 'localhost (::1)' can't be established.
RSA key fingerprint is a8:6a:b1:43:9b:33:e4:78:cc:d0:ee:9d:e0:c2:0e:fe.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
root@localhost's password: 
sending incremental file list
1G.file
       1.02G 100%   23.49MB/s    0:00:41 (xfer#1, to-check=0/1)

sent 1.02G bytes  received 31 bytes  21.12M bytes/sec
total size is 1.02G  speedup is 1.00

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

Ne yapıyorum ben!?

Dosya sahipliklerini ve izinlerini koruyarak taşımak başlıklı yazıyı okuyorsun.

Üst Veri