LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook
User Name
Password
Linux - Laptop and Netbook Having a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).

Notices

Reply
 
LinkBack Search this Thread
Old 03-27-2007, 06:17 PM   #1
ivlad2002
LQ Newbie
 
Registered: Jan 2006
Posts: 5

Rep: Reputation: 0
Question fitting 39 Gb disk image onto 39 Gb backup disk


I am trying to back up my laptop before trying to shrink its Windows partition and install Linux. It did not come with a system restore CD with drivers, so I must make sure I do not lose them.

Now the fun begins. The portable USB hard drive that I have is _exactly_ the size of the laptop hard drive (39 Gb). Well, there are 23 Gb free on the laptop, I told to myself, so it should fit...

Boot Knoppix 5.1.1 from Live CD, the hard disk to back up is hda1 (NTFS), the USB to back up to is sda.

I did:

su (otherwise it did not let me write to sda)

and, according to advice from linuxquestions.org/questions/showthread.php?t=362506

dd if=/dev/hda1 ibs=4096 conv=noerror | gzip > /media/sda/hda1.image.gz

I get:

gzip: stdout: no space left on device

What I am to do?? The laptop does not have a CD/DVD writer. I do not have a larger portable hard disk. I have space on a ftp server where to put a large image, but I doubt that dd can send output to ftp and that a 39 Gb file transfer can be done without errors. I have a desktop running Fedora with enough space, could I connect the two with a USB cable somehow and mount a volume on the desktop to be visible from the laptop? How would I do that? Fitting the image on the little portable would be so much better...

It's so tantalizing because: (1) 23 Gb are free on hda1, and (2) Even if I were to write 39 Gb, all is missing is a few thousand bytes, i.e. the size of the file table on sda.

Any suggestions?

Thank you,
Nick
 
Old 03-27-2007, 06:50 PM   #2
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 95
Hi.

FTP isn't a bad option.

The following should do the job:
Code:
mkfifo hda1.image.gz
dd if=/dev/hda1 ibs=4096 conv=noerror | gzip > hda1.image.gz
then in another terminal:
Code:
lftp username@ftp-host
<password>
put hda1.image.gz
The image will be transferred straight from gzip to the remote FTP site.

Do a 'gunzip -t' on the transferred image (if possible) to make sure it's OK.

Dave

Last edited by ilikejam; 03-27-2007 at 06:52 PM.
 
Old 03-27-2007, 06:53 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 10,453

Rep: Reputation: 622Reputation: 622Reputation: 622Reputation: 622Reputation: 622Reputation: 622
Have a look at the linux-ntfs utilities - ntfsclone. In your situation have a look at the "Special Image Format".
If you use any of the Linux tools (gparted say) for the resizing, you'll be using ntfsresize (from the same project) under the covers - very robust tools.
 
Old 03-28-2007, 05:16 AM   #4
ivlad2002
LQ Newbie
 
Registered: Jan 2006
Posts: 5

Original Poster
Rep: Reputation: 0
trying ntfsclone

Thank you all for your prompt replies. I'll try the ntfsclone thing first, since ftp-ing a 39 Gb file would probably take 2 days, and my web hosting provider does not offer ssh access to run gunzip -t to check integrity.

From the link you kindly gave: "Usually, Windows will not be able to boot, unless you copy, move or restore NTFS to the same partition which starts at the same sector on the same type of disk having the same BIOS legacy cylinder setting as the original partition and disk had". This means that after doing

Code:
ntfsclone -s -o /media/sda/hda1.image /dev/hda1
I have to also back-up the Master Boot Record with

Code:
dd if=/dev/hda1 of=/media/sda/hda1.mbr bs=512 count=1
according to Wikipedia . To restore from backup, I first restore the MBR:

Code:
dd if=/media/sda/hda1.mbr of=/dev/hda1 bs=512 count=1
and then I restore the NTFS image with

Code:
ntfsclone -r --overwrite /dev/hda1 /media/sda/hda1.image
The only things left unaddressed are:

(1) How to find the disk sector the original partition started in (needed at restore time)

(2) How to control where ntfsclone writes its output on disk to make sure it does not overwrite the MBR.

(3) How tell ntfsclone at what sector to write the image on the disk to be restored, or how to find out where it was written and move it with some other tool to the correct sector after writing.

Is what I wrote correct? Does anybody have any ideas on how to do these things?

Thank you,
Nick
 
Old 03-28-2007, 05:40 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 10,453

Rep: Reputation: 622Reputation: 622Reputation: 622Reputation: 622Reputation: 622Reputation: 622
O.k., backing up the MBR is pointless - almost always.
No need in this case.

The clone is just a safety in case it all goes to hell - you'll hope to never have to restore it. Just have it there in case, then do the resize. In truth, I have so much faith in (Linux) ntfsresize I never bother. And I do the resize a lot.
I reckon it's better than Partition Magic - how's that ???.
So, take the backup (it's compressed), do the resize, create the Linux partitions in the newly freed up space, and start the install.
It's that easy.

Answers to questions;
(1) "/sbin/fdisk -l" (may need root or sudo depending on distro) Write down the output.
(2) not an issue - the MBR is not part of the writable disk for normal utilities.
(3) if you have to restore, set things up as they were initially (that stuff you wrote down, remember ?), and use that NTFS partition to restore to. The utility will look after things in need.
 
Old 03-28-2007, 05:24 PM   #6
ivlad2002
LQ Newbie
 
Registered: Jan 2006
Posts: 5

Original Poster
Rep: Reputation: 0
Smile

Thank you very much!! It worked!

Nick
 
Old 03-29-2007, 04:45 PM   #7
ivlad2002
LQ Newbie
 
Registered: Jan 2006
Posts: 5

Original Poster
Rep: Reputation: 0
A few hours after finishing, I accidentally found about Clonezilla ( clonezilla.sourceforge.net ), which automates the ntfsclone procedure. That would actually be the best way.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
disk to disk backup for debian/Mempis on bootable cd-- advice loninappleton Linux - Software 3 05-27-2005 01:00 AM
can I backup a root disk and boot from the new backup disk linuxbkp Linux - Enterprise 3 10-15-2004 06:42 PM
What is the best sofware to backup an image of a hard disk of any OS? rooch84 Linux - Software 7 08-09-2004 03:28 AM
disk to disk backup phahn Linux - Newbie 13 05-09-2004 07:36 AM
Using Knoppix for disk image backup johnp Linux - Software 1 04-28-2004 11:26 PM


All times are GMT -5. The time now is 08:14 PM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration