Klaus Knopper is the creator of Knoppix and co-founder of the LinuxTag expo. He currently works as a teacher, programmer, and consultant. If you have a configuration problem, or if you just want to learn more about how Linux works, send your questions to: firstname.lastname@example.org
Live CD Tricks
I sometimes use a Live CD and dd to image a computer's internal drive to a USB drive before I do something dangerous to it:
dd if=/dev/sda of=./laptop_backup
This technique works well, but the only way I know to get at the data is to restore the whole thing to the system. If I had backed up a single partition
dd if=/dev/sda1 of=./root_filesystem
I could mount that file as a filesystem and copy data out of it. But I don't know how to do that if the image is of an entire drive with a partition table. Is this possible?
Yes, it is. For mounting filesystems in Linux, it makes (almost) no difference whether the filesystem is located on a hard disk partition or inside a file.
If you create a partition image with dd if=/dev/sda1 of=./root_filesystem, a loopback mount:
sudo mount -o loop,ro root_filesystem /media/test
will expose the filesystem structure residing in the partition copy file. (The /media/test target directory must exist before issuing the mount command.)
The same approach is possible if partitions are located inside an entire hard disk dump; however, finding out where the partition starts and ends can be a little tricky.
For example, if laptop_backup is the file containing your complete hard disk dump (created by the first dd command you typed above), you can find out where partitions start and end with the following command:
fdisk -u -l laptop_backup
The resulting output is shown in Listing 1.
01 You must set cylinders. 02 You can do this from the extra functions menu. 03 04 Disk laptop_backup: 0 MB, 0 bytes 05 255 heads, 63 sectors/track, 0 cylinders, total 0 sectors 06 Units = sectors of 1 * 512 = 512 bytes 07 Disk identifier: 0x00000000 08 09 Device Boot Start End Blocks Id System 10 laptop_backup1 * 63 8401994 4200966 7 HPFS/NTFS 11 laptop_backup2 8401995 16595144 4096575 83 Linux 12 Partition 2 has different physical/logical endings: 13 phys=(1023, 254, 63) logical=(1032, 254, 63) 14 laptop_backup3 16595145 18699659 1052257+ 82 Linux swap / Solaris
Don't worry about different physical/logical endings right now; you just need the start values, which are given in sectors of 512 bytes when the fdisk -u option is specified, so you now calculate the start of partition 2 (of type Linux) as follows:
Lecho $((8401995 * 512)) 4301821440
Now that you know the filesystem starts at byte offset 4301821440 in the hard disk image, you can mount it with
sudo mount -t ext2 -o loop,ro,offset=4301821440 laptop_backup /media/test
which should read-only-mount the stored partition 2 content under /media/test. Usually, mount is able to find the matching filesystem, so you can leave the -t ext2 or specify a different filesystem. In theory, you also should limit the size of the mounted "virtual" partition, but because the filesystem contains the correct size in its meta information, also calculating the ending value for sizelimit is unnecessary; the offset mount option is sufficient.
I just got a Lenovo T61 with Ubuntu 8.04 installed on it. It is the widescreen model and Ubuntu is great, except for one important detail. The PC projectors that I have to use when I visit businesses to make presentations are not widescreen.
I have tried to set the screen resolution to 1024x768 and other screen resolutions that are non-widescreen, but Ubuntu shows the selected resolution, which you can see from the command bar, in the center of the screen, stopping short on both the left and the right side, but the background image of the heron covers the entire widescreen beyond the border of the screen resolution I have just set. To make matters worse, when I run OpenOffice Impress in SlideShow mode, Impress fills the widescreen and leaves the PC projector only showing part of the image, even though I have the laptop set to 1024x768 (i.e., non-widescreen). How can I get the laptop to work properly with the PC projectors?
Widescreen internal displays often cause trouble with external non-widescreen monitors and projectors. Effects vary from blank bars on the side of the screen, to cut off edges, to mostly correct projector pictures with only a partly visible picture on the internal display. (This partial visibility is the case on the EeePC when the external port is set to higher resolutions than the capabilities of the internal display.) Basically, the desktop-integrated helpers for changing screen resolution on the fly use the randr extension of the graphics chipset to get a matching resolution on internal and external ports. For KDE, this is krandrtray (which usually runs inside the desktop panel); for LXDE, this is lxrandr (a standalone application that can also be used for other Gtk+-based desktops).
For some chipsets, it is even possible to have different (virtual) internal and external resolutions. Still, the problem with widescreen (16:9) vs. standard PAL (4:3) geometry remains because the chipset in most cases cannot run different frequency divisors on the external vs. the internal port.
The best solution seems to be shutting down the internal display signal completely and using an external VGA splitter to get a picture on an external monitor and projector. In this case, the signal on the external port is not set to match a widescreen picture simultaneously on the internal display. Make sure you have an easy way to switch the internal display back on in case you lose the picture on the external ports. I use a hotkey command on my desktop to execute
xrandr --output LVDS --auto
which re-enables the signal on the internal display. In this command, xrandr is the command-line tool for changing resolutions, and LVDS is the internal display of your notebook. The external port is called VGA for the --output parameter. For getting the best result on an external 1024x768 projector, I use this sequence:
xrandr --output LVDS --off xrandr --output VGA -s 1024x768
(Try --mode instead of -s if the preceding command does not work.)
Sometimes autoconfiguation works, in which case the projector tells your graphics chipset its preferred resolution automatically, then you would use:
xrandr --output VGA --auto
Yet you still might have to disable the internal display beforehand. It could happen that the resolution change works but your desktop fails to adjust itself to the new screen resolution and gets "stuck."
In this case, it is helpful to switch to the text console with Ctrl+Alt+F1 and back to X with Ctrl+Alt+F7 (or Ctrl+Alt+F5, depending on which console the X server is running).
I have the SUSE 11.0 DVD, and the instructions say I should set the BIOS for booting via DVD. Since I don't have said booting possibility, do I have to buy a better motherboard and chip, and if so, will it run my optic drives CD-RW/DVD-ROM? My HD is 120GB with a WD500GB external HD. I am more than a bit baffled on the partitioning of the 500GB EXT HD.
If your PC cannot boot from DVD, you still have some options for installation. If the boot menu (for many BIOSes, this is displayed by pressing F12 during startup) is missing, you might have to install to the internal hard disk. Linux runs fine from external disks and non-primary drives; however, if the computer's BIOS does not allow this, you might have to use a special boot manager or re-partition your internal hard drive to install at least the kernel part of Linux – maybe parallel to an existing OS that you want to keep – and use the external disk as an add-on for all operating systems.
With a few modifications, you can get a bootable CD or DVD to boot from a USB memory stick or hard disk, but if the BIOS does not allow booting from the DVD, you might have trouble booting to a USB stick.
Also, you might want to try using a boot manager that loads from a floppy disk – have a look at http://wiki.linuxquestions.org/wiki/Boot_Floppy, which describes different techniques for allowing an initial boot from floppy, then giving control to the DVD. An alternative method could be removing the hard disk from your PC and installing it "offline" from a different PC that is capable of booting from DVD.
Symantec says Linux-Darlioz burrows in through PHP.
Dell renews its quest for the ultimate developer machine.
Innovative back door looks like normal SSH traffic.
One of CeBITs most successful forums opens the new year with a new name. The popular Open Source Forum continues in 2014 under the name Special Conference: Open Source. This year, the forum will be bigger and offer a wider range of possibilities for sponsors.
New release offers better graphics drivers and expands filesystem support.
New mail protocol will shut out the NSA and prevent snooping on metadata.
A new web application helps users visualize distributed denial-of-service attacks.
Ubuntu 13.10 takes a step toward convergence, with lots of mobility, but Mir only partly here.
Galileo board is targeted to embedded developers and educational institutions.