sudo dd if=/dev/sda1 bs=32M | 7z a -si /data/$(date +%Y%m%d_%H%M%S)_sda1-backup.tar.7z
7z utilizes all CPU cores. Also, adding bs=32M
or with some other non-default values may significantly speed up the process.
Test results:
root@pentagon:~# dd if=/dev/sda1 | bzip2 -c > /data/$(date +%Y%m%d_%H%M%S)_pentagon-backup-sda1.bz2
12288000+0 records in
12288000+0 records out
6291456000 bytes (6.3 GB) copied, 2033.77 s, 3.1 MB/s
root@pentagon:~# dd if=/dev/sda1 bs=32M | 7z a -si /data/$(date +%Y%m%d_%H%M%S)_pentagon-backup-sda1.tar.7z
7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=C,Utf16=off,HugeFiles=on,64 bits,4 CPUs x64)
Creating archive: /data/20210818_104748_pentagon-backup-sda1.tar.7z
Items to compress: 1
5917M + [Content]187+1 records in
187+1 records out
6291456000 bytes (6.3 GB) copied, 1393.34 s, 4.5 MB/s
Files read from disk: 1
Archive size: 818956969 bytes (782 MiB)
Everything is Ok
Almost 2 times faster.
root@pentagon:~# ls -Alh /data
....
-rw-r--r-- 1 root root 1.2G Aug 18 10:40 20210818_100651_pentagon-backup-sda1.bz2
-rw-r--r-- 1 root root 782M Aug 18 11:11 20210818_104748_pentagon-backup-sda1.tar.7z
....
And, almost 2 times smaller.
Credits to Igor Pavlov for that.