LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 01-29-2015, 08:39 AM   #1
caveman86
Member
 
Registered: Nov 2014
Location: Adelaide, South Australia
Distribution: Slackware 14.1 x64, LFS 7.6 x64
Posts: 83

Rep: Reputation: 8
DD to restore compressed hard drive images


Hi guys I have a question and I am a little unsure of by what i have read I just want to know how to do it simply.... My question is I am installing a new hard drive in my laptop I have my partitions backed up as individual compressed files made by dd and I also have one complete image of the whole drive now my current HDD is 120B my new drive is 160GB how do I restore my images onto a new drive I have slackware on one and a LFS project on another how do I go about restoring them onto my new drive from my external HDD I know how to fix the boot loader once i have restored the images cheers guys
 
Old 01-29-2015, 08:47 AM   #2
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
related:
http://www.linuxquestions.org/questi...76#post5308276

this is what i do whenever i lose my fedora live-usb and it works pretty well:
Code:
dd if=/dev/sdb bs=2048 | bzip2 > fc-20.iso.bz2          # to create the image
bunzip2 -c fc-20.iso.bz2 | sudo dd of=/dev/sdb bs=2048  # to restore the image
 
1 members found this post helpful.
Old 01-29-2015, 08:52 AM   #3
caveman86
Member
 
Registered: Nov 2014
Location: Adelaide, South Australia
Distribution: Slackware 14.1 x64, LFS 7.6 x64
Posts: 83

Original Poster
Rep: Reputation: 8
Looks pretty simple so what about the partitioning will it automatically do all that or will i have to set that prior to restoring the image that is what is confusing me the most I have the images there just in case of hdd failure but am unsure of how to restore them as I never had to restore them yet thank you for the quick reply it looks rather simple.
 
Old 01-29-2015, 08:55 AM   #4
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
the image of the whole disk should contain the mbr, partition table, and partitions.
the images of just the partitions should just hold the partition data.
 
Old 01-29-2015, 09:32 AM   #5
caveman86
Member
 
Registered: Nov 2014
Location: Adelaide, South Australia
Distribution: Slackware 14.1 x64, LFS 7.6 x64
Posts: 83

Original Poster
Rep: Reputation: 8
No worries I will be installing my new hard drive during the course of the day I will report back and let you know how I go thank you for the help just needed to clear it up as was unsure about the partition table data etc before I went about doing this task as I said before I have backed up my data before and on numerous occasions keeping recent images of my hdd for the event of hdd failure however I run regular fsck checks of my hdd and found that I have a number of bad blocks that have appeared recently so my hard drive is failing so have purchased a refurbished one to replace the one I am using so now I am going to be utilizing the image of my hard drive I created finally anyhow cheers again and will let you know how i went
 
Old 01-29-2015, 09:36 AM   #6
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
fyi: my experience is with dd'ing images from/to the same disk.

let us know how it goes, i think as long as you have the backups safe you can try-try-again.

good luck.
 
Old 01-29-2015, 09:39 AM   #7
caveman86
Member
 
Registered: Nov 2014
Location: Adelaide, South Australia
Distribution: Slackware 14.1 x64, LFS 7.6 x64
Posts: 83

Original Poster
Rep: Reputation: 8
No problems thank you for the information I am using an external hard drive that contains the data of my images to transfer to my new hdd on my laptop will keep you posted cheers
 
Old 02-01-2015, 06:00 AM   #8
caveman86
Member
 
Registered: Nov 2014
Location: Adelaide, South Australia
Distribution: Slackware 14.1 x64, LFS 7.6 x64
Posts: 83

Original Poster
Rep: Reputation: 8
Ok I am finally reporting back with the results now for some reason when I used the image of the whole drive of all partitions I had issues with superblock errors and couldn't chroot into my slack partition to be able to fix grub however when I made images of individual partitions and made partitions of the same size and put the images of the partitions on my newly made partitions I had no issue mounting and being able to chroot into the slack partition to fix grub weird I don't know what I was doing wrong however the superblock error was odd so for future reference I am making individual partition images and if i have to ever restore them I will do it individually and won't use a whole image maybe someone might come along and point out where I went wrong I couldn't find the info i needed to fix the superblock error however issue is fixed and I am now talking to you on my new hard drive running my slackware install from my old hard drive cheers
 
1 members found this post helpful.
Old 02-01-2015, 06:11 AM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
And FWIW, I reckon dd is the absolutely worst option for backups. The worst. Period.
dd has its uses, but (normal) data backup ain't one of them.

If you have any errors on the filesystem, dd will blindly copy them for you - because that is what it is supposed to do.

For validated data backup have a look at something like fsarchiver.
 
1 members found this post helpful.
Old 02-01-2015, 06:18 AM   #10
caveman86
Member
 
Registered: Nov 2014
Location: Adelaide, South Australia
Distribution: Slackware 14.1 x64, LFS 7.6 x64
Posts: 83

Original Poster
Rep: Reputation: 8
I will look into it for future reference I never had to restore a system using a image before so many people rave on about DD being the best as I said never had to do this till now I always made backup images just in case but never had to use them till now and making a image of the whole drive was useless the only way it worked was making individual partitions into images but anyhow I will look into other backup options for the future.
 
Old 02-04-2015, 06:46 PM   #11
zrdc28
Member
 
Registered: Dec 2007
Location: Alabama USA
Distribution: Slackware current
Posts: 309

Rep: Reputation: 55
I have an old e machines computer that I use for a server. There is no raid or any type of backup of any kind. Every few months I just plug in another drive configured as a slave on the same cable. Then do a "dd if=/dev/sda of=/dev/sdb bs=512 conv=noerror,sync" I will then unplug both drives and use the slave as my primary to be sure it works, and keep in the computer,then put the primary that I pulled out, and put it on the shelf for the next time.

Last edited by zrdc28; 02-04-2015 at 06:48 PM.
 
1 members found this post helpful.
Old 02-04-2015, 10:24 PM   #12
dr.s
Member
 
Registered: Feb 2010
Distribution: Slackware64-current
Posts: 338

Rep: Reputation: 156Reputation: 156
Quote:
Originally Posted by schneidz View Post
...this is what i do whenever i lose my fedora live-usb and it works pretty well:
Code:
dd if=/dev/sdb bs=2048 | bzip2 > fc-20.iso.bz2          # to create the image
bunzip2 -c fc-20.iso.bz2 | sudo dd of=/dev/sdb bs=2048  # to restore the image
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
 
2 members found this post helpful.
Old 02-04-2015, 10:50 PM   #13
dr.s
Member
 
Registered: Feb 2010
Distribution: Slackware64-current
Posts: 338

Rep: Reputation: 156Reputation: 156
Quote:
Originally Posted by caveman86 View Post
Hi guys I have a question and I am a little unsure of by what i have read I just want to know how to do it simply.... My question is I am installing a new hard drive in my laptop I have my partitions backed up as individual compressed files made by dd and I also have one complete image of the whole drive now my current HDD is 120B my new drive is 160GB how do I restore my images onto a new drive I have slackware on one and a LFS project on another how do I go about restoring them onto my new drive from my external HDD I know how to fix the boot loader once i have restored the images cheers guys
Instead of using dd, I'd back up the filesystem itself using tar.
Code:
mount /dev/sda1 /media/sda1           #mount partition, cd to it
cd /media/sda1
tar cvfp /media/backup/sda1.tar --exclude tmp ./      #tar contents of ./ directory, exclude tmp

Last edited by dr.s; 02-04-2015 at 10:52 PM.
 
1 members found this post helpful.
Old 02-05-2015, 05:00 AM   #14
caveman86
Member
 
Registered: Nov 2014
Location: Adelaide, South Australia
Distribution: Slackware 14.1 x64, LFS 7.6 x64
Posts: 83

Original Poster
Rep: Reputation: 8
Quote:
Originally Posted by dr.s View Post
Instead of using dd, I'd back up the filesystem itself using tar.
Code:
mount /dev/sda1 /media/sda1           #mount partition, cd to it
cd /media/sda1
tar cvfp /media/backup/sda1.tar --exclude tmp ./      #tar contents of ./ directory, exclude tmp
If only I knew backing up my system was that easy I would of done it that way thank you for advising me on this as a backup solution I use the tar command all the time and never thought of it as a means to back up my partitions after all the trouble I went to in the first place to get my image to work again was a nightmare using DD as I stated I made a image of the whole drive that didn't work was only when I restored the partitions individually it worked without superblock errors etc etc I am spewing I didn't realize tar was a backup solution +1 for the advice I will do that from now on thanks heaps
 
Old 02-05-2015, 05:03 AM   #15
caveman86
Member
 
Registered: Nov 2014
Location: Adelaide, South Australia
Distribution: Slackware 14.1 x64, LFS 7.6 x64
Posts: 83

Original Poster
Rep: Reputation: 8
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
Thank you also for this advice as well I have backup solutions using compressed files instead of DD I quite like that how easy is that I never thought of it now I won't forget cheers
 
  


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 01:09 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