/dev/sda is the convention when communications with your disk go through the SCSI driver directly. In a comment, you said your disk was at /dev/vda : such naming is somewhat common on virtualised solutions. If I were to guess, I'd say you're talking about a KVM-managed VPS.
If you want to backup your /dev/vda disk, simply use slm's suggestion:
ssh user@remote "dd if=/dev/vda | gzip -1 -" | dd of=image.gz
This will backup /dev/vda entirely, and you will be able to re-dd it onto another disk later, provided there's enough room there.
fdisk -l worked and my device file is /dev/vda1, but does that contain my entire system?
You read that too quickly. /dev/vda1 is a partition (a piece) of the /dev/vda disk. Three things to note:
- If your system consists solely of a root partition at
/dev/vda1, then backing up /dev/vda1 is enough. You don't need to backup the whole drive (which also includes disk "headers").
- If your system spans across multiple partitions on
/dev/vda, then you must dd all of them in order to get everything (or just dd the whole disk like above).
- Your system might also be using several disks! It is a bit rarer, but I guess it could happen. You could have the
/ and /var partitions on /dev/vda (at /dev/vda1 and /dev/vda2 for instance), and the home directories (/home) at /dev/vdb1 on another drive (/dev/vdb).
In your case, I'd say lsblk is the right tool to understand your setup. Run it and have a look at the MOUNTPOINT column. Whenever there's something there, your system is using the partition on that row. If you want to backup the whole thing, you have to either:
- Download all used partitions (
/dev/vdXY) to files. A partition is used when it is mounted somewhere.
- Download all used disks (
/dev/vbX) to files. A disk is used when it contains at least one used partition.
If other words, you can either run:
ssh user@remote "dd if=/dev/vda | gzip -1 -" | dd of=disk1.gz
ssh user@remote "dd if=/dev/vdb | gzip -1 -" | dd of=disk2.gz
# ... and so on, once per used disk.
or (using my 2-disk example from above) :
ssh user@remote "dd if=/dev/vda1 | gzip -1 -" | dd of=root.gz
ssh user@remote "dd if=/dev/vda2 | gzip -1 -" | dd of=var.gz
ssh user@remote "dd if=/dev/vdb1 | gzip -1 -" | dd of=home.gz
# ... and so on, once per used partition.
An advantage to backing up partitions separately is that it might be easier to explore them locally when needed:
$ gzip -d home.gz # decompress the backup
$ sudo mkdir /mnt/home_bak # create a mount point
$ sudo mount -o loop home /mnt/home_bak # mount the backup
$ cd /mnt/home_bak # explore the home backup
Finally, remember that lsblk only lists mounted partitions. If you've setup extra partitions (ones you don't mount automatically at boot), remember to include those. Chances are you'd remember if you had done that when installing your VPS.
lsblk,fdisk,df...fdisk -lworked and my device file is/dev/vda1, but does that contain my entire system? All configurations and everything?dda live filesystem us asking for trouble. It might get an uncorrupted copy but it probably won't, and when you come to use the image it won't restore. I would strongly recommend that you either use something likersyncto perform a file-level backup or you ask your VPS provider if they can snapshot the running system and put the image in a place accessible for you to copy.