I want to make a copy of /home on my USB. To do this I am running this command: sudo find /home | cpio -o > /dev/sdb
while Im logged as root user.
I have previously made sure that /dev/sdb is the directory associated with the USB using: sudo fdisk -l
But when I run the command it has no output, it shows nothing and there is no new file on the USB. I understand that copying /home will take a few minutes (although I have a practically new Ubuntu installation), any idea why it's not copying anything?
/dev/sdb
is the device, which in the Unix/Linux world is an abstraction for the actual hardware device (a USB drive in your case). In order to write data (in this case an archive of/home
) to this type of device, you'll need to do the following. Maybe you've already completed some of these steps, but for completeness I'll list each below:fdisk
andparted
. If you need to partition the USB drive yourself, these commands will also be useful.parted
. On Ubuntu (and most flavors of Linux) ext4 is a common filesystem format, and you can use themkfs.ext4
command to format a partition for ext4.mount
command. You can also use themount
anddf
commands to check existing mounts on your system. Note you may need to adjust the permissions and/or ownership on your mount point to allow reading and writing by the appropriate user.You should be ready to write to your USB at this point via the directory where your device partition is now mounted. Note that for the commands I listed above you'll need to research the flags and options that are available for each.