0

Can I rsync a full hdd partition (which is inaccessible) to a remote directory?

Inaccessible means it cannot be mounted, it was part of LV volume merged with other HDD which is faulty and removed from the server. I tried to mount it but not working unknown filesystem type 'LVM2_member' so I'm using rsync to mount it on remote desktop. Advise me what's the best solution?

rsync -avz /dev/sda1 user@ip:/backup/

I want to copy all files and directories of /dev/sda1 to remote device at the directory backup.

3
  • 2
    What do you mean, inacccessible? Mount it and rsync the files. It'll be much more efficient than rsyncing a whole block device with all its empty space. Commented May 22, 2015 at 19:22
  • @PSkocik inaccessible means it cannot be mounted, it was part of LV volume merged with other HDD which is faulty and removed from the server. I tried to mount it but not working unknown filesystem type 'LVM2_member' so I'm using rsync to mount it on remote desktop. Advise me what's the best solution?
    – Zaher
    Commented May 22, 2015 at 20:19
  • 1
    If the problem is unavaliable partition, you will resolve nothing with rsync,you must use kpartx
    – elbarna
    Commented May 22, 2015 at 20:50

3 Answers 3

1

You can do

dd if=/dev/sda of=back.sda bs=10M 

You can increase or reduce the bs(block size) based on your i/o capacity(fast increase,slow decrease),then copy the back.sda with scp or rsync on backup. Later you can mount the image and recovery the files,this will work if sda is not broken disk,if is corrupted you can try a fsck. Rsync works for files,i have never tried on block device but i think rsync sda copy only the sda block file(size 0) on remote backup If the problem is unavaliable partition, you will resolve nothing with rsync,you must use kpartx,search google for kpartx lvm Or try this

pvscan
vgscan
vgchange -ay

See the output and mount the volume

3
  • 1
    FWIW, bs stands for "block size" (as in tape blocks), not "byte size".
    – lcd047
    Commented May 22, 2015 at 19:57
  • 1
    Why do you use dd? It's difficult to use reliably and not fast. Commented May 22, 2015 at 22:15
  • I have read now is an unavaliable volume,dd is not a good solution,try kpartx
    – elbarna
    Commented May 22, 2015 at 22:45
1

rsync -avz /dev/sda1 user@ip:/backup/ would attempt to copy the device node, not the disk content.

You can make an image of the partition as a remote file:

ssh -C user@ip:/backup/sda1.img </dev/sda1

This makes an image of the partition. It won't give you access to your files. In order to access your files, you need to mount the partition or the image: that's what mounting means.

If you only have one disk in a two-disk volume group, you won't be able to get your files from it, because you only have half a filesystem. Half a filesystem doesn't mean you have half the files, any more than having half a car doesn't mean you can travel on half the roads. If you have half a car, you can use it for parts, but you can't drive it. If you have half a filesystem, you may be able to use forensic techniques to recover some of the data, but it's hard work and individual files and directories are likely to be split over the two disks anyway.

If your volume group is split over two disks and one of the disk fails, your whole volume group is effectively lost.

-1

try GNU ddrescue to copy from the bad HDD to a file.

1
  • Hi! It would be best to show an example of how to use this command, and especially how to use it to create a remote image, as the question asks.
    – dhag
    Commented Dec 14, 2015 at 19:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .