I used 2 commands cpio and tar to perform the same operation of backing up data to an external drive which is my 8Gb pen drive (sandisk brand). At the time of executing the commands, it outputs something implying that it has backed up something but when I check the media, it is blank.

ravi@ravi-Aspire-5315:~/Documents/testing$ find . -type f -newer .last_time 
ravi@ravi-Aspire-5315:~/Documents/testing$ find . -type f -newer .last_time | cpio -o > /dev/sdb2
1 block

Now please look at the backed up media.

ravi@ravi-Aspire-5315:/media/ravi$ df -h | grep sdb2
/dev/sdb2       3.9G  8.0M  3.7G   1% /media/ravi
ravi@ravi-Aspire-5315:/media/ravi$ ll
total 24
drwxr-xr-x 3 ravi ravi  4096 Jan 12 11:10 ./
drwxr-xr-x 3 root root  4096 Nov 20 13:51 ../
drwx------ 2 root root 16384 Jan 12 11:10 lost+found/

I tried many times by backing up all files also but noting is shown in the above directory /media/ravi which is mount point of /dev/sdb2

I tried the tar command but the same issue.

ravi@ravi-Aspire-5315:~/Documents/testing$ tar -cvf /dev/sdb2 `find . -type f -newer .last_time`

Then I found that my media /dev/sdb2 got corrupted! enter image description here

Then to check the media via nautilus, I clicked on the media file. enter image description here

Here it is mentioning that the mount point is /media/ravi/poon but df -h mentions a different mount point /media/ravi

ravi@ravi-Aspire-5315:~/Documents/testing$ df -h | grep sdb
/dev/sdb2       3.0T  3.0T  3.9G 100% /media/ravi

The size is also wrongly shown now as 3.0T though it is 3.9 GB as shown in the command output in the beginning of this thread.

The above is what I found in my pendrive.

Before using this media, I 1st tried in an SD card of 32 GB. There also the issue was coming. So, I felt that the issue is with the SD card as I suspected the ingenuity of that card. But after using my branded 8GB pendrive (sandisk brand) bought from amazon.in, I am confirmed that the problem is something else.

  • 1
    You are writing the tar & cpio output directly to the device / partition instead of to a file on the filesystem.
    – Jeff Schaller
    Jan 12, 2016 at 8:32
  • @JeffSchaller yes it has worked perfectly after I wrote the tar & cpio output to a file in the filesystem. Oh! that means for backing up, we can't use the device file directly rather we have to give the path name of the file where we want to back-up. That really doesn't sound pleasant to me! "tar -cvf /media/ravi/poon find . -type f -newer .last_time"
    – Ravi
    Jan 12, 2016 at 12:47
  • Do you want a filesystem or a raw block device (ala tape)?
    – Jeff Schaller
    Jan 12, 2016 at 13:25

1 Answer 1


You need to treat /dev/sdb2 as either a raw partition or as a filesystem, not as both. It appears as though you created a filesystem on it at one point and mounted it at /media/ravi, but as soon as you piped tar or cpio output directly to /dev/sdb2, you ruined the filesystem.

Either write to a file on the filesystem, or treat it as a raw device that you do not mount.

  1. (recreate the filesystem on /dev/sdb2 and mount it at /media/ravi)

  2. tar -cvf /media/ravi/backup.tar find . -type f -newer .last_time

  3. tar tf /media/ravi/backup.tar


  1. umount /media/ravi ## if possible

  2. tar -cvf /dev/sdb2 find . -type f -newer .last_time

  3. tar tf /dev/sdb2

  • yes when I unmounted the media /dev/sdb2, then I was able to use tar with the device name i.e. /dev/sdb2. Thank you very much for your valuable assistance.
    – Ravi
    Jan 13, 2016 at 10:20

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.