LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-05-2015, 07:35 AM   #16
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918

Quote:
Originally Posted by dr.s View Post
Not sure you need dd, here's another way using gzip
Code:
gzip -1 < /dev/sda1 > sda1.img.gz   #create a /dev/sda1 partition image (using fast compression)
gunzip > /dev/sda1 < sda1.img.gz    #restore the image to /dev/sda1
i didnt even know gzip could write to block devices... can you do the same thing with cat ?
 
Old 02-17-2015, 11:51 AM   #17
dr.s
Member
 
Registered: Feb 2010
Distribution: Slackware64-current
Posts: 338

Rep: Reputation: 156Reputation: 156
Quote:
Originally Posted by schneidz View Post
i didnt even know gzip could write to block devices... can you do the same thing with cat ?
I've used gzip/gunzip for partition backups on my laptop. Haven't used cat before for this purpose so I tried it in a virtual machine, it seems to work...
Code:
umount /dev/sda2
cat /dev/sda2 > sda2.cat.img         #cat image
gzip -1 < sda2.cat.img > sda2.cat.gz #cat image, gzipped, fast compression
gzip -1 < /dev/sda2 > sda2.gz        #gzip image

mount sda2.cat.img /mnt/tmp          #mount img as a loop device
ls /mnt/tmp                          #files should be there
umount /mnt/tmp
...                                  #mount /dev/sda2, delete some files then unmount
cat sda2.cat.img > /dev/sda2         #restore from cat image
mount /dev/sda2 /mnt/tmp             #mount /dev/sda2, files seem to have been restored
...but when I ran a diff on the 2 gzipped files they were different. May be I'm doing it wrong or missing something, not sure I'll try it on my laptop's partitions
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Hard drive partitioning, backup and restore full disk images Tem2 Linux - Newbie 36 01-17-2012 08:33 AM
Images to PDF on extrunal hard drive Htoad2020 Linux - Newbie 4 08-12-2010 02:05 AM
Saving images to hard drive cherith.brook Linux - Newbie 1 10-23-2007 05:06 PM
Install Debian from images on hard drive? rconan Debian 3 01-10-2006 11:54 AM
mounting a compressed hard drive kaltag Linux - General 0 02-13-2004 04:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration