0

I'm unable to back up files using cpio.

root@ravbholua-Aspire-5315:/home/ravbholua/CCPP/HelloWorld/das/das1/book/backup# ls
arg_check.h  compute.h  quit.h
root@ravbholua-Aspire-5315:/home/ravbholua/CCPP/HelloWorld/das/das1/book/backup# ls | cpio -ov > /dev/sda10
arg_check.h
compute.h
quit.h
1 block
root@ravbholua-Aspire-5315:/home/ravbholua/CCPP/HelloWorld/das/das1/book/backup#

Though the above output shows the files, yet when I check my partition /dev/sda10 the files aren't present there. Where have I misunderstood?

1
  • 2
    Did you really mean to try and write a CPIO archive to a block device? That seems like a rather odd thing to do. If you want to put the files on that device, you need to mount it first. If that is what you intended to do, you have probably damaged the filesystem on /dev/sda10.
    – Chris Down
    Dec 11 '13 at 3:48
2

You are not using cpio correctly. http://www.gnu.org/software/cpio/

What you did is write the contents of the file to a block device representing a partition. You likely ruined the file system on that partition. cpio should be used to write things to a tape device, tar archive or other files.

What you probably wanted is something like:

mount /dev/sda10 /mnt  
cd /home/ravbholua/CCPP/HelloWorld/das/das1/book/backup  
cp -r * /mnt/  
umount /dev/sda10  

In order to mount /dev/sda10 you will need to fix the file system. If it is ext you MIGHT get lucky run fsck and hope.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.