LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Need help w/ restore disk project (https://www.linuxquestions.org/questions/linux-newbie-8/need-help-w-restore-disk-project-535223/)

CyberCod 03-06-2007 07:49 PM

Need help w/ restore disk project
 
Contained in this thread is the journey to the solution.

FOR COMPLETE SOLUTION INSTRUCTIONS CLICK HERE.



This is a project whose goal is to make a DSL based restore disk for a very old laptop with very limited hardware.

The machine specs are:
133Mhz Pentium 1
32MB ram
1.6GB Harddrive
CD-rom


In order for it to work, I have to make a backup of the current installation of DSL and put that and a script on a remastered DSL disk, and edit the /opt/bootlocal.sh file to call the script.

Further explanation of everything is contained elsewhere in the thread and on the SOLUTION THREAD



Below is the original first post.
------------------------------------------------------
I"m trying to make an easy backup system for a very old laptop that I'm customizing for a co-worker's 11-year-old daughter.

I was wondering if anyone could give me some tips if I were to accurately describe the situation.

--------------------------
The Situation
--------------------------



The computer in question is a VERY old laptop that was bought at a flea-market. Its a Fujitsu Lifebook 735Dx. System specs: 133Mhz Pentium, 32MB ram, 1.6GB harddrive, floppy drive is missing.
I've installed DamnSmallLinux, and spent a week customizing it to run on the machine as best as I can. Its doing good now, surprisingly. It has office applications, web-browsing, ebooks, and streaming music via Xmms and Shoutcast. I've got it networked via Samba to my own machine which has plenty of space and a burner.

--------------------------
The Problem
--------------------------

This girl is only 11 years old. She's going to mess it up somehow. I know it. I"m mostly just doing the job as an opportunity to learn DSL on a challenging piece of hardware. She's going to mess it up, and I need some way of making a restore disk so that I'm not constantly re-doing it out of geek-moral obligation.


I looked at SystemRescueCD and all that, but its system requirements are way to high for what I'm working with. The command dd looks very promising, but there' so many variables and no-one has made any mention of using it with Samba. I'd really need someone to give me examples for this specific case before I understood what to do.

A live disk is not really my favorite way to go either as the system has such a low amount of RAM that even the DSL live disk (which is only 50MB) ran sluggishly.

I don't just want to backup some files and folders, I want to back up the whole file-system, and the MBR to a bootable CD (the entire install is only about 400MB on a 1.3GB partition) and have aliases and or scripts set up so that she can restore it to the state I deliver it to her in with just a couple simple commands.

If I can make an ISO, I can move it to my main machine for burning. I also need to figure out how to restore it across the network, in case my first attempts fail.

I realize that on most machines these days that a filesystem would span several disks and be very complicated, or need a utility like SystemRescueCD. But in this specific instance, I believe it is theoretically doable. If I restore the MBR, then the partitions should be just like they are, there's no chance of the hardware changing, its too old for anything to be compatible. If I can then restore everything from a tar with permissions intact, then it should boot up just like it is at the moment I make the image... right?

As I said, I spent a week just setting it up. I do not wish to get experimental. I need all the help I can get. I'm not a complete noob, nor am I too lazy to research, I just didn't find anything that looked like it would do what I needed in such a special situation.


If you can give me a clue what to do, or send me in the right direction as to research, I would be very grateful. And you'd feel good knowing you helped keep a child off Windows.

Care to help?

Emmanuel_uk 03-07-2007 12:54 AM

surely if she does not have root privilege
and if you backup /etc and maybe some of her profile (desktop etc), you will not need a restore CD!

Otherwise, sound like if you boot with a DSL CD
I think you can backup the whole HD with dd over a network (never tried myself). I know you said dsl is slow, you may be able to use http://www.toms.net/rb/ with some customising

You said samba, but can you not install nfs on the desktop. DOes the desktop run linux?

This is all I can contribute I am afraid

AwesomeMachine 03-07-2007 02:58 AM

I would make a backup image file with dd and netcat. The instructions are in this post:

http://www.linuxquestions.org/questi...d.php?t=362506

Use your browser and search for "netcat". That will take you to the proper place in the post. You'll need another Linux box, or install Cygwin in MS Windows and use it to run dd and netcat. You can alternatively hack a live CD, but trust me this is a lot easier.

Junior Hacker 03-07-2007 03:13 AM

Also, you can get the info from page 98 of this document below which is probably where Awesome got it originally as it was Awesome's thread where I learned about this product. Highlight it and put it in Google search field to take you to the download site.

Helix-for-Beginners.pdf

If I did'nt have to shutdown Mandrake and boot into Fedora to see what page it was on, I would have beat you Awesome.

CyberCod 03-07-2007 06:20 PM

Thank you all for your replies,

My other desktop is an Ubuntu machine. NFS is available, but I've yet to use it at all, mostly because of inexperience. Now from what I've read so far, my best bet lies in making a compressed backup of the filesystem. A dd image would be the same size as the original partition, which is 1.3GB and won't fit onto a single cd. A tar on the other hand would give me only the actual size of the filesystem or less. That would fit fine on a cd, with whatever files I would need to do the restore process.

Restoring the MBR would give me back grub (which would be pointed at hda1) and the partition setup. So the swap would be there, and hda1 would be there for the filesystem to be copied back into. Formatting may or may not be neccessary... i don't know, being that in all likelihood that the partitions won't be damaged, writing the same mbr back over itself won't destroy the info inside the partitions. Am I right in thinking this?

Please understand I'm not trying to argue with anyone, and I appreciate all your advice. I'm just trying to get a game plan in my head.

The restore disk would need to boot up and just give a couple options. So I'm thinking a terminal based bootable Linux CD, no need for graphics or whatnot. An autorun script to ask if you want to restore or exit. If you select restore, it would restore MBR from backup, then restore filesystem from tar into hda1, and then reboot.

If there are any flaws in this reasoning, please point them out.

I know each step is more complicated than I'm making it sound, and I'll have to research it all. I already saved the instructions for backing up the MBR with dd and restoring it. The tar is somewhat understood, though I'll have to get a better handle on the syntax than I have now. The biggest hurdle is customizing a bootable linux cd to come up and run a script, and what that script would entail.

I'm going to take some time to study the suggestions I've gotten so far, but sticking with a network restore solution is out simply because I want a permanent solution that doesn't involve having the machine returned to me whenever there's a problem.

So far I've converted 11 people and 15 different machines to Linux. Mostly Ubuntu. I've written about it repeatedly in the local newspaper, where I have a weekly tech column. In all those cases, allowing the user to re-install wasn't so big of a deal because Ubuntu pretty much installed all the drivers correctly. But when I started with this laptop, the only thing working properly were mouse, monitor and keyboard and harddrive. Everything else, from usb-wifi card to the sound to getting the swap set up and recognized had to be done manually. Not to mention customizing the interface. Needless to say, I learned a lot. Which was the whole point. But during the process, i had to re-install twice just due to file-system errors introduced when I had to hard-boot because of a lockup. All of the desktop customization is done via text files, and isn't user friendly at all. While I did this to learn, I don't want to give the girl something that will only be cool until she accidently trips over the cord. (the battery is shot)

Thats why I don't feel confortable just restricting permissions and backing up a few folders.

I think that if I can make it cool, and make it so that if she messes it up, she can fix it on her own, that she'll use it for quite a while and maybe even get to know a bit about how it works, not to mention introducing the idea of Linux to all of her peers.
In time, she'll learn to customize it further. But at first, it has to be as non-intimidating as it can be.

I believe users should be responsible enough to figure out how to use the terminal a bit. But in the beginning, it needs to be easy so that it doesn't scare them away.

I've only been using Linux for about 6 months, but I'm already a believer. My own 3 PC's use it, I've installed it for my brother, my two best friends, my mother, my mother-in-law, her sister, and just about anyone that will let me to tell the truth.

I'm sorry, i've gotten off subject and gone on a rant.

Forgive me.

I've got some reading to do. I look forward to future comments and advice.

Junior Hacker 03-07-2007 10:39 PM

Ok

I try not to push my favorite too much because this is a Linux forum, but your needs can be met with 3rd party software that I use exclusively. I use a multi-tool called bootitng which is a boot manager, can create, slide, non-destructive re-size, wipe, and image partitions or volumes. The images are compressed, my Fedora uses 6GB of it's partition and the images are 1.5GB. It can write the image to another partition (NTFS, FAT), or to CD's/DVD, another drive, thumb drive, USB drive, and I'm not sure but theoretically it should write the image to a networked drive, but I have not had the opportunity to try. If you were to name the image "LINUX", the file would be called "LINUX.IMG" which you can then burn to a data CD so it can be restored from the CD drive. If you had a burner you could just write directly to it, but I don't think that's possible. If you could add a second drive temporarily and write the image file there and then plug that drive in a computer with a burner to write the image to a data CD would work, but I don't think that is an option either. So you may only have the network drive option for writing it too as I'm sure this lappy does not have USB 2 for writing to USB drives.
You can download the documentation or go ahead and download bootitng which is not all that big and it has the documentation within in .pdf. You can use it for free forever till you decide to install it for it's boot manager features, but all the other nice tools you can use without obligation.
They also have Image for Linux which you will see on the web-site, I don't know what's the scoop with it's 30 day trial, you'll have to read I guess. It clearly states network capability. In any event, you can download these products and play with them for free, so what can you loose. I think you'll find what you need here, do some reading. I give you a link to a thread where I mention some of the benefits of bootitng that I like (the benefits are many), and a link to the vendor.

http://www.linuxquestions.org/questi...03#post2659303

http://www.terabyteunlimited.com/

EDIT: I guess I should mention, I work on customer computers, after re-building an OS I apply all available updates, do some optimizing, and then when it's ready to go I make an image and store it on DVD's with others. If the computer comes back I just wipe the drive and restore the image to save time. It does'nt matter how big the drive is as only data get's imaged, but the partition has to be same as original, and I make the original with bootitng to make sure it fits. MBR is not in the image with bootitng because after wiping the drive I have to re-make the partition and that's when the MBR get's written. It may be a different story with Image for Linux. Make sure to read carefully before using bootitng, you can still go ahead and try making an image with it, then go through a mock restore, and part ways through you will see what size it needs before actually doing the restore. Just to see if the image is valid. You probably won't have that limitation with Image for Linux.

Emmanuel_uk 03-08-2007 01:17 AM

http://sourceforge.net/projects/g4l
Ghost for Linux is a hard disk and partition imaging and cloning tool similar to Norton Ghost(c).

otherwise can you make a tared dd backup?
I never tried...
say
mkfifo /mnt/network/someplace/backup.gz
tar someoption /mnt/network/someplace/backup.gz
dd if=/dev/hda1 of=/mnt/network/someplace/backup.gz someoptions
then you would revert the process

Please post your script if you ever solve your problem (I think you will); it would be interesting

http://www.howtoforge.com/back_up_re...th_ghost4linux

about the autostart tweaks
http://sourceforge.net/forum/forum.p...orum_id=408762

jschiwal 03-08-2007 03:58 AM

There is an example using tar in the "info tar" manual that you may find useful. What is the network connection between the two computers? Does her computer have USB. If so, an external CDROM burner could be used or an external USB drive or even a 2 GB pen drive could hold a backup of the image. Because the image is below the 2BG filesize limit, you don't need to use

I searched for an old post where I suggested using netcat:
Code:

On the source laptop ( In this example, it's IP address is 192.168.1.100 ):
$ dd if=/dev/hda2 bs=512 | netcat -l 3333


For the destination:

$ nc 192.168.1.100 3333 | dd bs=512 of=lifebook.img

For this example, the drive being cloned is hda2.

Also, keep in mind that you can pipe the output of dd through gzip to compress it. To restore, cat the image file through gunzip.

If you have root access, you can even use cat instead of dd on her machine if dd isn't installed:
# cat /dev/hda2 | netcat -l 3333

If course, if you have NFS, then you can mount a share on her machine and you don't need netcat. However, for a one shot deal, using netcat may be easier then setting up NFS on both machines.

Whatever method you use, I would recommend using the md5sum program on the device and the final transferred image to make sure the transfer went OK.

----

For reference, this webpage on netcat may be useful:
http://www.g-loaded.eu/2006/11/06/ne...eful-examples/

Emmanuel_uk 03-08-2007 04:12 AM

dohh I said tar, but I meant a pipe to gzip

in fact as the laptop is very old, it would make sense
to gzip of=lifebook.img on the desktop (using the desktop cpu I mean)

CyberCod 03-08-2007 05:22 AM

I found a bootable cli-based linux version at the link below... i downloaded the NON-X version to mess with. I'm going to try it out in VMware.

Didn't have time for reading, had an emergency repair to do last night. But you can look at my first candidate for the base of the boot cd.


http://www.tux.org/pub/people/kent-r...looplinux/rip/

Question, if you unpack an archived folder over an existing folder, if there are files that do not exist in the archive are they overwritten?

Thanks for all the time, attention, and encouragement.

And yes, I'll share any scripts and procedures.

Anyone know a good ISO editor for linux?

jschiwal 03-09-2007 04:56 AM

No. Existing files will not be deleted if they don't exist. Actually there is a potential problem with tar when used for backups. If you start from the initial backup and apply subsequent incremental backups ( timestamp based ), the files deleted since the first backup will not be deleted. Altered files will be replaced like you would expect of course, but if a file was deleted tar doesn't take notice. Another issue is if you use ACLs. There is another program called "star" which will back up the ACL data associated with files and directories.

Another backup program is dar. It stands for Disk ARchive and is handy performing backups to CDs or DVDs. There is a kde GUI frontend for dar called kdar. Kdar will remove files when performing incremental backups.

A CD or DVD ISO image is readonly so you can't edit it. You can mount them very easily.
mkdir imagedir
mount -t iso9660 backup.iso imagedir/ -o loop,unhide

No the CD is mounted on imagedir/.

You need to copy the files to another directory and make your changes there. After that you can create a new ISO file or burn it. The easiest way is to use K3B.

CyberCod 03-09-2007 06:55 PM

Thanks for the info. As far as incremential backups, I'm only going to make the one. After I give it to the girl, its her baby.

And as far as pre-existing software goes, I'm kind of looking forward to figuring this out. The whole project was a learning experience. This is just a continuation of that.

From what I gather from your posts about how tars handle overwriting, then there's a chance that documents and media files downloaded won't be effected by the restore so long as nothing is formatted first.

If I make two options, one where the drive is formatted and one where it is not, then she may have a chance to restore everything without losing any personal files. And if that doesn't fix her troubles, she can go back and do the format-restore.

If I just copy the files from a bootable ISO, add to them and adjust them, and then make a new ISO out of them, will it be bootable? Is there something else that has to be done?

Thanks again for the help.

PS> Whats an ACL?

Emmanuel_uk 03-10-2007 05:11 PM

I knew there was something better out there I read a few weeks ago
found the mag again here is the reference
http://www.sysresccd.org/Main_Page
it is possible to make customized versions of the disc. For example, you can add your own scripts, to make an automatic restoration of the system.
SystemRescueCd-x86-0.3.3 (121.47 MiB)

So it leaves you plenty of space on CD to add the iso

Let us know how this goes

CyberCod 03-10-2007 08:07 PM

Emmanuel_uk, thanks for the attempted help, but I'm working with a seriously limited machine here. The site says...

Quote:

Be aware that this operation requires a large amount of memory (both RAM and space on the hard disk). If you don't have 128 MB of RAM, and at least 700 MB free on your hard disk, it will fail. You can create a swap partition in order to avoid problems with the squashfs step in the script.
There still may be a way, using the swap partition mentioned, I've got 900MB of free space, but my swap space is only 199MB... so I dunno.

I'm going to try to make one, using the RIPlinux non-X disk (to start out with). Wish me luck. I hope to have some of the bigger obstacles worked out this weekend.

CyberCod 03-11-2007 08:40 PM

Ok, I'm having trouble with my "tar" syntax.

Right now, / is hda1, and hda3 is mounted at /mnt/hda3.

I tried:

tar -cvzpsf /mnt/hda3/backup.tar /dev/hda1
says something about removing leading "/" from member names, and is done in a moment... so thats not it

removing the / from the front gives me
tar -cvzpsf mnt/hda3/backup.tar dev/hda1
results in no such file or directory.

I need it to preserve permissions and directory structure, putting good compression on it is not exactly neccessary as it will fit on the disk uncompressed... and uncompressing will make it take longer.

Any help here would be appreciated.

Thanx.

----edit----
I found instructions via google that seem to be working, I just had to boot to commandline mode on the DSL cd and do it.

the page I found is http://inferno.slug.org/cgi-bin/wiki...up_And_Cloning

I adjusted the tar command to include the "-cvzpsf" part... though I'm thinking I should have left out the "z". It does seem to be packing it up though.

The above page says to use:
cvzf
which is
create, verbose, gzip, file archive

a friend in the #dsl channel on freenode said to use:
cpsf
which is
create, same permissions, same order, file archive

I combined the two to make it
cvzpsf
which is
create, verbose, gzip, same permissions, same order, file archive

I'll be checking it out after its complete to see if all went properly.


All times are GMT -5. The time now is 07:49 PM.