Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Making an image of an entire hard drive. (solved)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
<3
Veteran
Veteran


Joined: 21 Oct 2004
Posts: 1081

PostPosted: Tue Dec 10, 2013 3:42 pm    Post subject: Making an image of an entire hard drive. (solved) Reply with quote

I have a laptop that I use for work, it is a dual-boot Win7/Gentoo GNU/Linux machine, that unfortunately needs repair due to my clumsiness. I have an extended warranty on the hardware so the insurer requires that if I want my laptop fixed that I need to take the hardware into an established computer repair shop (they will not pay for me to fix it myself). Before I take the laptop into a computer repair shop I want to make backup of my entire hard drive including all partitions, (Win 7 (ntfs), swap, root (ext4), boot (ext2) and an extra ntfs partition). Is it possible for me to make an image of the entire drive (partition layout and all) and back it up to a spare hard drive that I have laying around?

Last edited by <3 on Sat Dec 14, 2013 8:37 am; edited 1 time in total
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3104

PostPosted: Tue Dec 10, 2013 4:06 pm    Post subject: Reply with quote

`dd if=/dev/sda of=/dev/sdb bs=64M`
where /dev/sda is damaged device and /dev/sdb is a new one (phisical devices, not partitions' numbers) - make sure you replace paths with correct one.
Devices with equal size are preferred since it will make a copy, but if you use bigger target drive you can repartition it afterwards to reclaim unused space
Back to top
View user's profile Send private message
wjb
l33t
l33t


Joined: 10 Jul 2005
Posts: 601
Location: Fife, Scotland

PostPosted: Tue Dec 10, 2013 5:19 pm    Post subject: Reply with quote

Clonezilla. Does what it says on the tin.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10587
Location: Somewhere over Atlanta, Georgia

PostPosted: Tue Dec 10, 2013 5:30 pm    Post subject: Reply with quote

szatox wrote:
Devices with equal size are preferred since it will make a copy, but if you use bigger target drive you can repartition it afterwards to reclaim unused space
Better to write to a file on the mounted second drive if, as I'm assuming, the goal is to later restore the exact image to the repaired laptop's hard drive.

By the way, it goes without saying that no part of /dev/sda should be mounted while this copy is being made. Doesn't it? ;)

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1555
Location: Montréal

PostPosted: Tue Dec 10, 2013 6:20 pm    Post subject: Reply with quote

You can use the dcfldd command instead of dd, you will see a progress output that dd do not show.

If you try to restore the backup to an other drive than the one who Windows was installed in, Windows can refuse to boot. Windows memorise the exact first sector where it start on the partition and if that have change after the restauration it will not boot.

I ever had this problem before. A Gentoo user in this forum told me I have to use an hexadecimal editor on the Windows partition to change the written first sector where Windows memorise it to correspond to the starting new one after the restauration.

Again, you see that manipulating Windows filesystems can be more complicated than the Linux ones. This example is only one licence restriction consequence.
_________________
Paul
Back to top
View user's profile Send private message
<3
Veteran
Veteran


Joined: 21 Oct 2004
Posts: 1081

PostPosted: Wed Dec 11, 2013 1:50 am    Post subject: Reply with quote

I don't plan on changing the disk, So after they fix the problems with the laptop I will restore the image on the original drive, hopefully I won't have that problem.
Back to top
View user's profile Send private message
<3
Veteran
Veteran


Joined: 21 Oct 2004
Posts: 1081

PostPosted: Thu Dec 12, 2013 2:34 am    Post subject: Reply with quote

This clonezilla program does not appear to be in portage. Also I just realized I will not be able to use dd because I am backing up a 500GB drive and the largest back-up drive I hava available is only 320GB which means I am going to have to do a full reinstall =(.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10587
Location: Somewhere over Atlanta, Georgia

PostPosted: Thu Dec 12, 2013 2:56 am    Post subject: Reply with quote

Not necessarily. Try, for example, compressing the image:
Code:
dd bs=10M if=/dev/sda | bzip2 >image.bz2
Might very well fit in a file smaller than 320GiB.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
hadrons123
Tux's lil' helper
Tux's lil' helper


Joined: 08 Mar 2012
Posts: 90
Location: chennai

PostPosted: Thu Dec 12, 2013 3:27 am    Post subject: Reply with quote

<3 wrote:
This clonezilla program does not appear to be in portage. Also I just realized I will not be able to use dd because I am backing up a 500GB drive and the largest back-up drive I hava available is only 320GB which means I am going to have to do a full reinstall =(.


Clonezilla is not necessary to be in portage to perform this task. Its very easy to download the clonezilla live booting .iso image into a USB drive and transfer all your partitions to another drive. I do this on a daily basis. No failures in the last 6 months.

http://clonezilla.org/downloads/download.php?branch=stable
_________________
LENOVO Y580 FHD Intel® Core™ i7-3630QM CPU @ 2.40GHz × 8 |660M GTX NVIDIA | 16GB SanDisk SSD
Back to top
View user's profile Send private message
lost+found
Guru
Guru


Joined: 15 Nov 2004
Posts: 509
Location: North~Sea~Coa~s~~t~~~

PostPosted: Thu Dec 12, 2013 7:57 am    Post subject: Reply with quote

If you make backups of separate partitions (not the entire disk at once), don't forget to backup the MBR and the boot records of extended partitions as well. I don't know if that's included in Clonezilla though.
Back to top
View user's profile Send private message
hadrons123
Tux's lil' helper
Tux's lil' helper


Joined: 08 Mar 2012
Posts: 90
Location: chennai

PostPosted: Thu Dec 12, 2013 8:05 am    Post subject: Reply with quote

@lost+found
clonezilla does everything you suggested and its easy to manage as well.
_________________
LENOVO Y580 FHD Intel® Core™ i7-3630QM CPU @ 2.40GHz × 8 |660M GTX NVIDIA | 16GB SanDisk SSD
Back to top
View user's profile Send private message
wjb
l33t
l33t


Joined: 10 Jul 2005
Posts: 601
Location: Fife, Scotland

PostPosted: Thu Dec 12, 2013 11:35 am    Post subject: Reply with quote

Clonezilla is a bootable image - CD/USB, whatever. Can do all the partitions or just pick the ones you want. Its quick and produces relatively small images because it only looks at the used parts of the file systems. It knows about a lot of file system types, but will use dd to do a sector copy if its not one of these. You can restore into the same sized or larger disk. Used it at work to image W7/XP pcs, and on a mixture of PCs at home - never really had any problems with it. The website does have a very good step by step guide - which you wouldn't need after the first couple of times.

The command it uses is shown to you at some point so you can re-use the same one later without having to go through the menus again.
Back to top
View user's profile Send private message
silentplummet
n00b
n00b


Joined: 14 Jun 2004
Posts: 58

PostPosted: Sat Dec 28, 2013 2:03 am    Post subject: Reply with quote

You can make dd display current progress by sending it a signal either directly through terminal or by another process like killall. On my machine I think it's ^T or ^V that makes it work.
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Mon Dec 30, 2013 9:52 am    Post subject: Reply with quote

Problem with DD is it copies the "empty" space as well
_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
<3
Veteran
Veteran


Joined: 21 Oct 2004
Posts: 1081

PostPosted: Mon Dec 30, 2013 11:05 am    Post subject: Reply with quote

Thx guys I managed to get it to work using clonezilla, it was fairly easy to use too.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum