Softpanorama

May the source be with you, but remember the KISS principle ;-)
Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and  bastardization of classic Unix

Usage of Knoppix with Partimage

News Recommended Links CD-based SystemRescueCD
Alternatives to Norton Ghost Flash-drive based distributions Humor Etc

Debian-based Knoppix was one of the first bootable CD distributions and the oldest surviving bootable CD distribution. As of 2013 it is still maintained.  The main attraction of Knoppix for system rescue purposes is that it supports a vast array of hardware—if something doesn't work under Knoppix, chances are it's not supported in Linux.

Knoppix gives you GUI tools which are helpful during rescue operations. You can browse the web, which is extremely important. It also provides applications to write your log of the events in HTML with links intact (OpenOffice)

It is very popular and has excellent community support, including good articles on re-mastering Knoppix to customize it for yourself.

Start at the Knoppix Wiki, and especially the Cheat Codes.

These are several boot options  for dealing with funky hardware, or turning on special tasks. Among them:

The first keyword is always knoppix, like knoppix desktop=fluxbox toram.

Knoppix also comes in a DVD edition, if the CD version isn't enough for you.

It includes a useful set of system utilities (parted, partimage, fstools, ...) and basic ones (editors, midnight commander, network tools). It aims to be very easy to use: just boot from the cdrom, and you can do everything. The kernel of the system supports most important file systems (ext2/ext3, reiserfs, xfs, jfs, vfat, ntfs, iso9660), and network ones (samba and nfs).

We are mainly interested in Partimage. The process is pretty straightforward.

See Partimage Imaging - CECNdocs for more information


Top Visited
Switchboard
Latest
Past week
Past month

NEWS CONTENTS

Old news ;-)

[Jan 1, 2005] "Knowing Knoppix

is a beginner-friendly, 134 page freely downloadable book (released under the GNU Free Documentation License in PDF format). See also Slashdot Grokking Knoppix

O'Reilly title Knoppix Hacks [oreilly.com]

System recovery with Knoppix

Rescuing a non-booting Linux system
This is the most common scenario. Something goes haywire, and boom, no boot. No problem: boot up Knoppix and find all your local partitions nicely iconicized on the KDE desktop. (Or cruise the file tree to /mnt.) Click on the correct icon, and there are all your files. But they are wisely mounted read-only. Again, no problem: right-click the desktop icon to bring up a nice menu with a "Change read/write mode" option. This mounts the filesystem on the partition as read/write. Now you can edit any file.

The default user is knoppix. For operations that require root privileges, you need to su to root and assign a root password:

knoppix@ttyp0[knoppix]# su
root@ttyp0[knoppix]# passwd

To mount a filesystem read/write from the command line:

root@ttyp0[knoppix]# mount -t reiserfs -o rw /dev/hda5 /mnt/hda5

To unmount:

root@ttyp0[knoppix]# umount /mnt/hda5

If you get an error message "Could not unmount device, device is busy," something is reading the filesystem. Close files and cd out of the filesystem.

How do you know what mountpoint and filesystem to specify? Just read /etc/fstab:

root@ttyp0[knoppix]# cat /etc/fstab
...
# Added by Knoppix
/dev/hda5 /mnt/hda5 reiserfs noauto,users,exec 0 0

Hardware detection
Before going on a mad config file editing spree, it often pays to examine hardware information. Knoppix excels at this, as it has the latest editions of Linux's excellent hardware and system utilities: fdisk, lspci, iwconfig, ifconfig, dmesg, /proc, and so forth. (Checking hardware information is also handy for testing a system for Linux compatibility before you buy it. Sound cards, softmodems, and wireless NICs are especially troublesome; manufacturers often change the chipsets without changing the model numbers, and you need to know the chipsets to determine if Linux drivers are available. The Knoppix CD also contains a number of sound files, for quick sound testing, starting with "OpenMusic" on the welcome screen.)

And of course KDE provides a nice GUI to see all this; go to System > Info Center.

Rescuing data files
Usually the first rescue chore is to copy data files off of the troubled drive. This is my favorite method when there are large numbers of files to copy: install a second hard drive, then boot Knoppix, then copy files from the old disk to the new disk. Even if you don't have nice hot-swappable drives or removable drive cages, it takes just a couple of minutes to pop the case open and hook one up. Do you have a brand new blank drive, or an old one that needs to be wiped clean and reformatted? No problem, do the disk preparation from Knoppix.

Partitioning and formatting
First, install the second hard drive. Then boot Knoppix and open a root shell. If there are partitions already on the second disk, simply re-format whatever ones you need. Note that SCSI drives are designated sd, while IDE drives are hd. This command displays the existing disk partitions; be sure to use values appropriate for your system:

root@ttyp0[knoppix]# fdisk -l /dev/hdb

To format a disk partition:

root@ttyp0[knoppix]# mkfs.ext2 -c /dev/hdb1

This creates a plain-vanilla ext2 filesystem. -c checks for bad blocks. Of course, you can make it anything you like: ext3, ReiserFS, whatever:

root@ttyp0[knoppix]# mke2fs -j -c /dev/hdb1
root@ttyp0[knoppix]# mkreiserfs /dev/hdb1

What, no partitions? First, here's how to create them the command-line way, with fdisk. It's medium-safe to futz with fdisk, as changes are not written to disk until you give the command to do so. So, you can try different options and preview the partition table before committing to any changes. This sequence of commands creates a single partition:

root@ttyp0[knoppix]# fdisk /dev/hdb

Type "m" at any time to display a table of fdisk commands. Then, type "n" to create a new partition. Now, type "p" to create a primary partition. Hit Enter twice to accept the defaults. Or, if you don't want to use the whole disk, hit Enter once to accept the default starting point, then select the size you want:

+1000M

Hit "p" at any time to preview the new partition table. When everything looks good, press "w" to write the changes to disk. By default, fdisk creates a "type 83" partition, which means Linux. To see a list of partition types, press "l". To change the partition type, hit "t". Want to delete a partition? Easy as pie: press "d" and follow the prompts.

QTParted
Even easier is firing up KDE and using QTParted (System > QTParted). QTParted creates, deletes, and non-destructively moves and resizes partitions (even NTFS). So, you can make room to copy your data without losing anything.

Copying files the GUI way
I like graphical file managers. It's a lot simpler to drag and drop than to type out long command strings. Click on the icons on the KDE desktop that represent your source drive and the drive you want to copy them to. Each one opens in its own file manager, for fast and easy drag and drop. Be sure to make the destination drive writeable.

Copying files at the command line
Remember to create a directory to move files into:

# mkdir /mnt/hdb1/home/carla/backup
# cp -r /mnt/hda5/home/carla /mnt/hdb1/home/carla/backup

Cloning an entire drive
You'll need two hard drives the same size, or a destination drive larger than the source drive. Make sure no partitions are mounted on either drive. In this example /dev/hda is the source drive, /dev/hdb is the destination drive. The dd command makes an exact, byte-for-byte copy, including the MBR (master boot record):

# dd if=/dev/hda of=/dev/hdb

Mounting confusion
Are you losing track of what's mounted, and in what state? No problem, here comes /proc to the rescue:

# cat /proc/mounts

This displays all mounted filesystems, the filesystem types, read/write status, and other attributes. How many hard drives are on the system? One of these will tell you (and remember, SCSI drives are sd, IDE are hd):

# fdisk -l

or

# dmesg | grep hd

or

# dmesg | grep sd

Copying to CD
KDE and Knoppix make this easy. Assuming there is a CD writer on the system, simply right-click on the desktop icon for the partition containing your files, and you will see "Create Data CD with K3b." Do File > New Project, drag and drop the files you want to copy, and there you go. K3b is very good at autodetecting and autoconfiguring your CD drives; it should do it all for you. If something goes awry, please refer to the developerWorks article "Burning CDs on Linux", which also teaches how to burn CDs from the command line.

Copying to other media
Zip drives, floppy disks, and USB storage devices will be automatically recognized by Knoppix, and icons will be placed on the desktop. Simply make the drive you want to copy files to writeable, then drag and drop until it's all done.

Copying over the network
You can configure Knoppix to connect to a network, just like any other Linux. Knoppix has its own graphical configuration utility: on the main menu find Knoppix > Network/Internet. Again Knoppix's excellent hardware detection comes into play; it even works on wireless NICs (assuming it's a wireless NIC that is supported in Linux!). Simply answer a series of questions, and you're done.

It's just as easy from the command line. As root, run:

# netcardconfig

Once your network settings are configured, there are several options for transferring files. cp is fine for locally mounted filesystems. Copying files over an untrusted network should be done with scp (secure copy), and in fact Knoppix won't let you use anything else. scp uses ssh for encrypted file transfer and lets you move files without setting up NFS or Samba. You'll need an ssh server running somewhere on the network to receive the files. This command copies an entire directory:

# scp -rp /mnt/hda5/home/carla 192.168.1.5:/home/carla/tmp

SSH quickstart
What, you have no ssh server? If you really do not yet have ssh installed, here is a quick-start guide to running SSH. But before using it for even routine remote administration tasks, you should study ssh in more depth. Note also that there have been a number of important security patches issued recently.

OpenSSH comes with all major Linux distributions, and yours should already have it. (To find out, type locate sshd.) If not, download and install it. It doesn't need to be on a special machine; any Linux PC can run SSH. Start it up like so:

# /etc/init.d/ssh start

Then, all you need is for the same user to have accounts on both machines. Using root is easiest, but potentially dangerous. And, of course, you can create user accounts on Knoppix as needed, with useradd and passwd. Then run the scp command as in the example above, and there you go.

The first time you connect, you'll get a "The authenticity of host X can't be established...are you sure you want to continue connecting?" message. Answer "yes." It will ask for the root password of the SSH server, and then you're home free. To move files as a non-root user:

# scp -rp /mnt/hda5/home/carla [email protected]:/home/carla/tmp

Open a root shell on the host system
This lets you operate on the host system, as though you were logged into it directly. Identify the partition the host system is on, then open a Knoppix root shell and mount it:

root@ttyp0[knoppix]# mount /dev/hda1 /mnt/hda1
root@ttyp0[knoppix]# chroot /mnt/hda1
root@Knoppix:/

Knoppix glitches
Running programs from a CD can cause some odd troubles, especially on notebooks. It is common for power management to mess up a Knoppix session: when you wake up the machine, Knoppix doesn't respond to commands anymore. The only cure I know is to disable power management, or simply hit the power switch and start over.

Sometimes Knoppix gets stuck during boot, and hangs partway into KDE (or any X session) startup. Switch to the first virtual console (Ctrl + Alt + F1) to see the live system messages; this should tell you where the problem is. Hit Alt + F5 to get back to the default X session. For example, on one of my test systems it got stuck doing SCSI detection. Why? Who knows. I disabled SCSI detection by adding knoppix no scsi to the boot command, and that took care of it.

Knoppix creative ferment
Linux has always inspired amazing creativity. Knoppix has taken off in a big way, and there are dozens of inventive Knoppix-inspired projects, such as Inside Security Rescue Toolkit, OpenGroupware Knoppix, Damn Small Linux, and Overclockix. See the Resources section below for more information and links to how-tos for making your own customized Knoppix distribution.

Resources

Knoppix Linux Forums

Partimage, is probably preferable as long as the disk isn't too fragmented (and it should not -- it's up to you to ensure it ;-). Unless there is problem on creation you won't have any problems on restore. I did not.

My laptop HD is failing, so I want to create an image of the NTFS partition before the drive fails completely. I tried using partimage, which appears to work fine, but the "experimental" status of NTFS support makes me somewhat nervous.

Then I found out about ntfsclone, which would seem to do what I want. However, the the website is marked unmaintained, so I don't know how outdated the info I read would be.

What I need is the ability to restore the saved partition onto a new HD, swap the new HD with the old failing one, and have the laptop boot as if nothing has happened. The new HD would be of the same or largest size than the old HD (though in the latter case, I'd want the extra space be usable as well).

Any suggestions as to which tool would work better?

===

Another option is to use GHOST, but if the partition is damaged it might not work. I just recovered files from a defective drive using knoppix 3.7 with great results (but extensive period of time). I did it using Samba, Linux to Windows based network utility and just copied the files this way.

Markus wrote:

When my 40 GB hda drive was starting to sound like a frog I bought a 80 GB to replace it with. hda had only 1 partition, hda1. On the new drive I made several partitions, but I made hda1 slightly over 40 GB. Next I plugged them both in, booted knoppix, su'd to root and gave the command: dd if=/dev/hda1 of=/dev/hdb1 while the new drive was the slave on the cable at hdb.
This leaves out the bootloader so I chrooted and ran lilo, but If you just have windows you need to swap the new drive to master, boot with winCD into recovery console and issue fixmbr. When you then bootup the hd it will probably run scandisk but should work.

I know that dd would work, but it's also inefficient and slow. The fact that I have to back up over the network exacerbates the problem.

Another option is to use GHOST, but if the partition is damaged it might not work. I just recovered files from a defective drive using knoppix 3.7 with great results (but extensive period of time). I did it using Samba, Linux to Windows based network utility and just copied the files this way.

I assume you're referring to g4u, not Norton Ghost. From reading its website, it seems to copy everything, just like dd. Also, it seems to be more sensitive to disk geometry; restoring to larger disks may or may not work.

I guess I could go to the store and pick up Norton Ghost, but I'm too cheap.

SourceForge.net Partition Image FAQ

Crazed Mule Productions- using partimage with RAID

Using partimage to clone hard disks

In this HOWTO I'll explain the process of cloning hard disks over a LAN using freely-available Linux tools. The original purpose of this document was to assist other IT/support professionals within the company that I work for, but in the spirit of Open Source and the sharing of information, as it got more detailed I decided to take the extra step and contribute it to the IT community at large by posting it on the web. (Also, I did this because thumbnailed images don't work well in an email-circulated PDF.) There are other pages on the web that cover this, but this document assumes no prior knowledge of Linux. It does assume (but doesn't require) some familiarity with Norton Ghost.

This method of disk cloning attempts to get past certain limitations of Norton Ghost. One of these is licensing. For occasional or light use, it doesn't always make sense to purchase a license for Ghost. Another, more important issue, is that the Ghost Boot Wizard includes only a few drivers for common network card chipsets. While it is possible to get other drivers, many new network cards simply don't have DOS-based drivers anymore. By using Linux, there is no need to have several sets of boot disks for different network cards, and there is a much stronger chance that network functionality will "just work" upon booting the machine.


Cons:

User-friendliness - Norton Ghost is a much more complete and mature application than partimage, with more features, a friendlier interface, and good support. This method is not as intuitive as Ghost, and might be a bit confusing the first time it's used, but once you've done it a couple of times it's really not difficult at all.

No multicasting - One of the coolest things about Ghost is multicasting, which partimage doesn't do. (yet)

Pros:

Cost - Every tool we'll use here costs nothing. It's not shareware or even freeware; it's Open Source. Free to copy, distribute, and modify.

Hardware support - By using a "Live CD" distribution of Linux, we benefit from the regularly-released and updated hardware support of a full mainstream server/desktop operating system. There is no digging for network card or SCSI/IDE drivers. The OS either supports it right now or you can be sure it will within a very short time. There's no dependency on antiquated DOS drivers that a hardware vendor may or may not see the merit in creating and releasing.

Experience - While it's not a direct benefit for the task at hand, if this is your first exposure to Linux for system building, backup and recovery, you'll immediately see other uses for these tools.

The Partimage Backup Page

1. What is Partimage?
2. Why did you create this page?
3. What are the limitations?
4. What software do I need?
5. How do I download and create the Partimage Boot and Root disks?
6. What should I do to my Source drive before backing up?
7. How do I prepare a Backup hard disk for storing the backup files?
8. I'd like to use HDPARM to speed up the Backup/Restore process
9. I want to use Partimage to backup my partitions to a locally connected drive
10. I want to use Partimage to restore my partitions from a locally connected drive
11. I want to use Partimage to backup/restore a partition to a Network drive
12. How do I backup/restore my Source hard disk Primary and Extended partition table?
13. I need to create a new Boot disk with support for my NIC
14. I'd like to see the Partimage Help file
15. I'd like to see the Partimaged (Daemon) Help file
16. I need some more help with ifconfig and other BusyBox commands
17. I'd like to see some links to Linux documentation, Kernels, Modules and Distributions.
18. I need help with the mkisofs command
19. I'd like to add my modified Partimage boot disk to the Partimage Bootable CD-ROM image.
20. Help!! I need a quick and hopefully fool proof partimage program source now !!
21. I'd like some information on Ghost for Unix or g4u
22. I'd like to zero out (clean) a partition, slice or entire disk before backing up. I need help
23. How can I change the partimaged maximum client connection number?
24. I'd like to use the fully batch mode (-BX) what is the correct context?
25. I'd like to use the fully batch mode (-BX) and I am getting a delay with the partimage client
26. Partimage 0.6.4 can't restore MBR if image is bzip2 compressed. I need help
27. What are the known bugs for partimage 0.6.4?
28. I am getting Partimage errors with Linux kernel 2.6.9 and above

Recommended Links

Knoppix - Wikipedia, the free encyclopedia

**** System recovery with Knoppix

Knoppix links from Wikipedia article

  1. "KNOPPIX Linux Live CD: What license does the KNOPPIX-CD use?". http://www.knoppix.org/. Retrieved on 2007-07-16.
  2. http://lists.debian.org/debian-knoppix/2003/01/msg00173.html
  3. a b Knoppix Documentation Wiki:Cheat codes
  4. polishlinux.org - Live CD
  5. http://web.archive.org/web/20050708005508/http://www.knopper.net/knoppix/index-en.html

Free hard drive Backup and Restore, hard drive Image and Cloning Utilities (thefreecountry.com) -- a very good list. Highly recommended.

Disk cloning - Wikipedia, the free encyclopedia Contains good discussion of problems in cloning bootable windows partitions, Sysprep, a utility which runs hardware detection scans and sets the SID and computer name freshly when the machine boots and Universal Imaging Utility from Binary Research (original developers of Symantec's Ghost) which incorporates a large number of hardware device drivers into the sysprep routine.



Etc

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D


Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to to buy a cup of coffee for authors of this site

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Last modified: March 12, 2019