home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.os.linux.ubuntu      I preferred Xubuntu, seemed a bit faster      134,474 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 133,502 of 134,474   
   Paul to All   
   Re: how to incorporate gzip lines with m   
   02 Nov 23 06:39:55   
   
   From: nospam@needed.invalid   
      
   On 11/2/2023 3:52 AM, bilsch01 wrote:   
   > Hello, I was never very good at linux scripting, and now I've forgotten much   
   what I did know. I hope somebody here can help me incorporate gzip with the dd   
   copy lines I use for backing up laptop to an external drive. The two different   
   thumb drives I    
   use to boot laptop and copy SDD are   
   > 1) Ubuntu Installer and 2) Knoppix.  Both of those come with gzip.   
   > I've never actually ever used gzip.   
   >   
   > Here's the lines I use to copy the SDD contents to an external drive:   
   >   
   > ## first do fdisk -l to sort out the devices   
   > sudo mkdir -p /mnt/sdb1  (creating a mount point)   
   > sudo mount -t ntfs /dev/sdb1 /mnt/sdb1   
   > sudo mkdir -p /mnt/sdb1/images (if u don't already have that directory)   
   > sudo dd if=/dev/nvme0n1 of=/mnt/sdb1/images/asyymmdd.img bs=4096   
   conv=notrunc,noerror   
   >   
   > Here's the lines to restore the SDD if I ever need to:   
   >   
   > sudo mkdir -p /mnt/sdb1  (creating a mount point)   
   > sudo mount -t ntfs /dev/sdb1 /mnt/sdb1   
   > sudo dd if=/mnt/sdb1/images/asyymmdd.img of=/dev/nvme0n1 bs=4096   
   conv=notrunc,noerrer   
   >   
   > Thanks in advance.   
   > Bill S.   
   >   
      
   sudo dd if=/dev/nvme0n1 of=/mnt/sdb1/images/asyymmdd.img bs=4096   
   conv=notrunc,noerror   
      
   becomes   
      
      sudo dd if=/dev/nvme0n1 bs=4096 conv=notrunc,noerror | gzip -3 >   
   /mnt/sdb1/images/asyymmdd.img.gz   
      
   The dd program, when you remove the "of" specification, uses STDOUT.   
      
   GZIP accepts piped input. There are options of --fast and --slow which   
   correspond to -1 and -9. The value -3 for compression is the default,   
   and is shown as an example of a passed parameter. You might want to   
   test the output, and see if the size changes or not   
      
       ... | gzip -1 | wc -c     # count the bytes of output   
      
       ... | gzip -9 | wc -c     # count the bytes of output   
      
   With gzip, you have to be careful of the syntax,   
   so the original file is not deleted. That's what I spent   
   most of my time playing with, is checking for deletion.   
      
   *******   
      
   Later:   
      
      gzip -c -d /mnt/sdb1/images/asyymmdd.img.gz | sudo dd of=/dev/nvme0n1   
   bs=4096 conv=notrunc,noerrer   
      
   The -c sends the output to STDOUT.   
   The -d says "switch to decompression mode".   
   The input file is a compressed one.   
   Sending to STDOUT, also stops deletion of the input file.   
      
   The dd command, when there is no "if" specification, it inputs from STDIN.   
      
   The output file, the target, is the nvme.   
      
   *******   
      
   An alternate compressor you can try, is "pigz".   
      
      sudo apt install pigz   
      man pigz   
      
   Syntax is the same as gzip, and it accepts a  -p 4   
   parameter, which is the number of processor   
   cores to use for compression.   
      
   If you use exactly the same compression syntax as the   gzip -3   
   example, it uses all the cores on your CPU.   
      
      pigz -3           # On a 4C 8T processor, the default is -p 8   
      
   pigz output is ".gz" as before. gzip can be used for decompression.   
   pigz can be used for decompression. But during decompression, it   
   only uses one core. One claim I've seen, is decompression is typically   
   faster, so the lack of multithreading is not the end of the world.   
   It is compression that needs the horsepower.   
      
   You can use "top" or "gnome-system-monitor" to monitor the amount   
   of CPU usage during compression.   
      
   Anyway, I'm sure you have a whole collection of compressor commands.   
   There are compressors to produce smaller output, but they don't   
   run as fast.   
      
      Paul   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca