weblab
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| weblab [2010/05/22 14:19] – external edit 127.0.0.1 | weblab [2018/04/30 10:12] (current) – Meh, remove this old crap. aorth | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ===== WebLab ===== | ||
| - | [[http:// | ||
| - | WebLab is complicated to install and we received a disk image from the developers to try and install at ILRI-BecA. | ||
| - | |||
| - | Test system using virtual machine is running here: http:// | ||
| - | |||
| - | The image is **really** big, it is located in ''/ | ||
| - | * < | ||
| - | total 324G | ||
| - | -rw-r--r-- | ||
| - | -rw-r--r-- | ||
| - | |||
| - | ===== Working with the image ===== | ||
| - | |||
| - | ==== Find partitions ==== | ||
| - | It is a //raw// dump of a hard drive, master boot record, partition table, and partitions... everything. | ||
| - | * < | ||
| - | last_lba(): I don't know how to handle files with mode 81a4 | ||
| - | Disk weblab.img: cannot get size | ||
| - | Disk weblab.img: cannot get geometry | ||
| - | |||
| - | Disk weblab.img: 0 cylinders, 0 heads, 0 sectors/ | ||
| - | Warning: The partition table looks like it was made | ||
| - | for C/ | ||
| - | For this listing I'll assume that geometry. | ||
| - | Units = sectors of 512 bytes, counting from 0 | ||
| - | |||
| - | | ||
| - | weblab.img1 | ||
| - | weblab.img2 | ||
| - | weblab.img3 | ||
| - | weblab.img4 | ||
| - | |||
| - | So there' | ||
| - | * weblab.img1: | ||
| - | * weblab.img2: | ||
| - | * weblab.img3: | ||
| - | |||
| - | We obviously have no need for the swap partition, as we can just create our own. We can extract partitions one and three and manipulate them. This includes mounting to copy files or using directly with a virtualization application. | ||
| - | |||
| - | Booting off the image' | ||
| - | |||
| - | Overview: | ||
| - | |||
| - | - Dump partition | ||
| - | - Create new, empty partition image | ||
| - | - Mount old and new images | ||
| - | - Copy data from old -> new image | ||
| - | - Edit system settings (/ | ||
| - | - Unmount images | ||
| - | - Install GRUB on new boot partition | ||
| - | |||
| - | ==== Creating /boot partition ==== | ||
| - | |||
| - | We extracted the boot partition without its boot loader, so we need to copy it to a new, empty image and then add a boot loader (GRUB). | ||
| - | |||
| - | First, dump partition one from the weblab image, skip 63 sectors to where partition one begins: | ||
| - | * < | ||
| - | 1975932+0 records in | ||
| - | 1975932+0 records out</ | ||
| - | Now, create an empty 100 meg image for our new boot partition: | ||
| - | * < | ||
| - | 100+0 records in | ||
| - | 100+0 records out | ||
| - | 104857600 bytes (105 MB) copied, 0.653573 seconds, 160 MB/ | ||
| - | Attach a loop device to the image so we can address it as a block device: | ||
| - | * < | ||
| - | Create a partition on the block device (**n**ew, **p**rimary, | ||
| - | * < | ||
| - | Delete and recreate the loop device so the kernel knows about the new partition table: | ||
| - | * < | ||
| - | # losetup -f weblab_boot_new.raw</ | ||
| - | Now create a file system on the image' | ||
| - | * < | ||
| - | Then mount the image' | ||
| - | * < | ||
| - | # mount -o loop, | ||
| - | Mount the original boot image: | ||
| - | * < | ||
| - | # mount -o loop weblab_boot.img / | ||
| - | Copy everything over using cp's archive functionality (preserving time, date, permissions, | ||
| - | * < | ||
| - | Unmount both images: | ||
| - | * < | ||
| - | # umount / | ||
| - | We'll install grub right on the image (not using a block device). | ||
| - | * < | ||
| - | Type the following commands in grub: | ||
| - | * < | ||
| - | grub> root (hd0,0) | ||
| - | grub> setup (hd0) | ||
| - | grub> quit</ | ||
| - | |||
| - | If you don't have any errors you should be able to follow a simialar procedure to create a root partition. | ||
| - | |||
| - | ==== Creating / partition ==== | ||
| - | |||
| - | Because the root partition is so big it's a pain in the ass to dump, so we'll just mount it directly. | ||
| - | * < | ||
| - | |||
| - | Check the status of the mount... | ||
| - | * < | ||
| - | /dev/md2 on / type ext3 (rw) | ||
| - | ... | ||
| - | ... | ||
| - | / | ||
| - | # df -h | ||
| - | Filesystem | ||
| - | / | ||
| - | ... | ||
| - | ... | ||
| - | / | ||
| - | The partition is ext3 and there are only 40 gigs in use! | ||
| - | |||
| - | Create somewhere to copy the data, for example a 50 gigabyte empty file read from /dev/zero: | ||
| - | * < | ||
| - | 51200+0 records in | ||
| - | 51200+0 records out</ | ||
| - | Format the " | ||
| - | * < | ||
| - | Mount the new drive (it doesn' | ||
| - | * < | ||
| - | Verify the used space: | ||
| - | * < | ||
| - | Filesystem | ||
| - | / | ||
| - | ... | ||
| - | ... | ||
| - | / | ||
| - | / | ||
| - | The / partition (mounted here at / | ||
| - | * < | ||
| - | Unmount images: | ||
| - | |||
| - | Read the note about '' | ||
| - | * < | ||
| - | same as -dpR</ | ||
| - | It's the easiest way to recursively copy a bunch of files from one place to another while preserving time/date stamps as well as owner/group info. | ||
| - | |||
| - | ===== Booting qemu ===== | ||
| - | Having extracted the boot and root partitions, we can test them in a virtual machine: | ||
| - | * < | ||
| - | |||
| - | * Mount the root image and change ''/ | ||
| - | * Mount the root image and copy a new root hash to ''/ | ||
| - | * Mount the boot image to change grub's '' | ||
| - | |||
| - | ===== Troubleshooting ===== | ||
| - | |||
| - | ==== qemu crashes during boot ==== | ||
| - | |||
| - | Note to self: qemu on 64 bit host with a 64 bit guest does not like to run with the '' | ||
| - | * < | ||
| - | RSI=00007f392e505f18 RDI=00007f392e507000 RBP=00007fff0cb6b1a0 RSP=00007fff0cb6b000 | ||
| - | R8 =000000006fffffff R9 =0000000070000021 R10=000000006ffffdff R11=000000006ffffe34 | ||
| - | R12=0000000001dd40c0 R13=000000006fffff40 R14=00007fff0cb6b268 R15=0000000000000002 | ||
| - | RIP=00007f392eeb77a8 RFL=00010206 [-----P-] CPL=3 II=0 A20=1 SMM=0 HLT=0 | ||
| - | ES =0000 0000000000000000 00000000 00000000 | ||
| - | CS =0033 0000000000000000 ffffffff 00affb00 | ||
| - | SS =002b 0000000000000000 ffffffff 00cff300 | ||
| - | DS =0000 0000000000000000 00000000 00000000 | ||
| - | FS =0000 00007f392f0ba6f0 00000000 00000000 | ||
| - | GS =0000 0000000000000000 00000000 00000000 | ||
| - | LDT=0000 0000000000000000 00000000 00008200 | ||
| - | TR =0040 ffff88000100c080 00002087 00008900 | ||
| - | GDT= | ||
| - | IDT= | ||
| - | CR0=8005003b CR2=00007f392e505df0 CR3=00000000089d5000 CR4=000006e0 | ||
| - | DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000 | ||
| - | DR6=0000000000000000 DR7=0000000000000000 | ||
| - | Unsupported return value: 0xffffffff</ | ||
weblab.1274537972.txt.gz · Last modified: (external edit)
