sshfs を ssh に置き換える

sshfs を ssh に置き換える

私はまさにこれをするのが大好きです:

$ sshfs mountPoint myServer
$ cp thisFile mountPoint

現在 LiveCD を使用していますが、sshfs ユーティリティが利用できないため、実行する必要があります。sshfs$ sudo dd /dev/sdb2 > mountPointと同じくらい簡単にこれを行うにはどうすればよいですか?

おそらく関連がある

  1. https://superuser.com/questions/397646/cloning-fresh-windows-7-fsed-hdd-to-linux-server-because-having-no-external-hdd

Psusiへのコメント

$ sudo fdisk -l|tail
255 heads, 63 sectors/track, 4864 cylinders, total 78142806 sectors
Units = sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x181d6d22

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048     3074047    12288000    7  HPFS/NTFS/exFAT
/dev/sdb2         3074048   600563711  2389958656    7  HPFS/NTFS/exFAT
/dev/sdb3       600563712   625139711    98304000    7  HPFS/NTFS/exFAT
$ sudo file -s /dev/sdb
/dev/sdb: x86 boot sector; partition 1: ID=0x7, active, starthead 32, startsector 2048, 3072000 sectors; partition 2: ID=0x7, starthead 89, startsector 3074048, 597489664 sectors; partition 3: ID=0x7, starthead 254, startsector 600563712, 24576000 sectors, code offset 0xe
$ sudo ntfsclone --save-image --output - /dev/sdb2
ntfsclone v2011.4.12AR.4 (libntfs-3g)
ERROR(22): Opening '/dev/sdb2' as NTFS failed: Invalid argument
Apparently device '/dev/sdb2' doesn't have a valid NTFS. Maybe you selected
the whole disk instead of a partition (e.g. /dev/hda, not /dev/hda1)?

答え1

あなたの質問に直接答えるために

dd if=/dev/sdb2 ibs=1M | ssh -C myServer 'dd of=/path/to/destination obs=1M'

ボーナスとして、次の操作を行って進捗状況を確認できます(ユーティリティがある場合pv)。

pv /dev/sdb2 | ssh -C myServer 'dd of=/path/to/destination obs=1M'

答え2

SSH トンネル パイプを使用できます:

dd if=/dev/sdb2 ibs=1M obs=64k | ssh -C user@remotehost "cat > /path/to/destination"

この-Cオプションは、SSH プロトコルでの圧縮を有効にし、通常このような場合にパフォーマンスが向上します。

インストールしている場合はpv、パイプにそれを含めることで、すでに転送された量の詳細情報を取得できます。

dd if=/dev/sdb2 ibs=1M obs=64k | pv | ssh -C user@remotehost "cat > /path/to/destination"

答え3

すべての Linux ディストリビューションに付属しているセキュア コピーを使用することをお勧めしますscp

$ scp -r folder-to-copy location-of-copy

関連情報