Differences

This shows you the differences between two versions of the page.

Link to this comparison view

wiki:infrastructure_tools:ssh:ssh-dd [2014/02/01 22:40] (current)
Line 1: Line 1:
 +====== SSH - DD ======
 +
 +===== Preface =====
 +
 +Some time you will need to copy whole file system / HDD partition between SSH Serer and SSH Client. In this document I would like to describe the possibility to use SSH and DD to compress your file system / HDD partition between SSH Client and SSH Server. This can be used in the case that you would like to create backup of your file system / HDD partition or just create an image of your file system / HDD partition
 +
 +===== SSH Client ->​copy->​ SSH Server =====
 +
 +Example
 +
 +<​code>​
 +[root@SSH_Client ~]# df -h
 +Filesystem ​                 Size  Used Avail Use% Mounted on
 +/​dev/​mapper/​vg_SSH_Client-lv_root ​ 6.7G  2.0G  4.4G  31% /
 +tmpfs                       ​499M ​    ​0 ​ 499M   0% /dev/shm
 +/​dev/​sda1 ​                  ​485M ​  ​34M ​ 426M   8% /boot                                            # We would like to copy this file system
 +
 +[root@SSH_Client ~]# dd if=/​dev/​sda1 | ssh uaer@SSH_Server "dd of=~/​destination_file.img" ​         # Copy file system
 +user@ssh_server'​s password:
 +1024000+0 records in
 +1024000+0 records out
 +524288000 bytes (524 MB) copied, 39.9493 s, 13.1 MB/s
 +1024000+0 records in
 +1024000+0 records out
 +524288000 bytes (524 MB) copied, 36.8594 s, 14.2 MB/s
 +[root@SSH_Client ~]#
 +
 +[user@SSH_Server ~]$ ls ~/​destination_file.img ​                                                    # We have created this image
 +destination_file.img//​
 +//
 +</​code>​
 +
 +=====   =====
 +
 +===== SSH Server ->​copy->​ SSH Client =====
 +
 +Example
 +
 +<​code>​
 +[root@SSH_Server ~]# df
 +Filesystem ​                  ​1K-blocks ​   Used Available Use% Mounted on
 +/​dev/​mapper/​vg_SSH_Server-root ​ 10079084 7278204 ​  ​2288880 ​ 77% /
 +tmpfs                          1469708 ​      ​0 ​  ​1469708 ​  0% /dev/shm
 +/​dev/​sda1 ​                      ​198273 ​  ​64540 ​   123497 ​ 35% /boot                                # We would like to copy this file system
 +
 +[user@SSH_Client ~]$  ssh -C root@SSH_Server "dd if=/​dev/​sda1"​ | dd of=~/​destination_file.img ​     # Copy file system
 +root@ssh_server'​s password:
 +1024000+0 records in
 +1024000+0 records out
 +524288000 bytes (524 MB) copied, 32.2661 s, 16.2 MB/s
 +1024000+0 records in
 +1024000+0 records out
 +524288000 bytes (524 MB) copied, 36.0505 s, 14.5 MB/s
 +[user@SSH_Client ~]$
 +
 +[user@SSH_Client ~]$ ls ~/​destination_file.img ​                                                    # We have created this image
 +destination_file.img
 +</​code>​
 +
 +===== Mount Created Image =====
 +
 +The new created image is possible to mount like standard file system
 +
 +<​code>​
 +[root@SSH_Server ~]# mount -o loop aa/​destination_file.img /​media/ ​           # Mount the image like file system
 +
 +[root@SSH_Server ~]# df
 +Filesystem ​                   1K-blocks ​   Used Available Use% Mounted on
 +/​dev/​mapper/​vg_SSH_Server-root ​  ​10079084 7278200 ​  ​2288884 ​ 77% /
 +tmpfs                           ​1469708 ​      ​0 ​  ​1469708 ​  0% /dev/shm
 +/​dev/​sda1 ​                       198273 ​  ​64540 ​   123497 ​ 35% /boot
 +/​root/​aa/​destination_file.img ​   495844 ​  ​34540 ​   435704 ​  8% /​media ​        # It is mounted
 +
 +[root@SSH_Server ~]# umount /​media/ ​                                          # Unmount image
 +
 +[root@SSH_Server ~]# df
 +Filesystem ​                  ​1K-blocks ​   Used Available Use% Mounted on
 +/​dev/​mapper/​vg_SSH_Server-root ​ 10079084 7278204 ​  ​2288880 ​ 77% /
 +tmpfs                          1469708 ​      ​0 ​  ​1469708 ​  0% /dev/shm
 +/​dev/​sda1 ​                      ​198273 ​  ​64540 ​   123497 ​ 35% /boot
 +</​code>​
  
Navigation
Print/export
QR Code
QR Code wiki:infrastructure_tools:ssh:ssh-dd (generated for current page)