weblab
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| weblab [2009/08/31 08:26] – 172.26.0.166 | 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' | ||
| - | |||
| - | ==== /boot partition ==== | ||
| - | |||
| - | Dump the first partition without the master boot record (where the boot loader and partition table live). | ||
| - | * < | ||
| - | 1975932+0 records in | ||
| - | 1975932+0 records out</ | ||
| - | See? It's just an ext2 file system: | ||
| - | * < | ||
| - | weblab_partition1.img: | ||
| - | GRUB, a Linux bootloader, typically has problems booting off exotic filesystems, | ||
| - | |||
| - | Mount it as a loop device to see what's on it: | ||
| - | * < | ||
| - | [root@hpc-ilri weblab]# ls / | ||
| - | boot gentoo | ||
| - | |||
| - | ==== Extract data from / partition ==== | ||
| - | |||
| - | Mount the root partition to copy data directly to or from its filesystem. | ||
| - | * < | ||
| - | |||
| - | Check the status of the mount... | ||
| - | * < | ||
| - | /dev/md2 on / type ext3 (rw) | ||
| - | ... | ||
| - | ... | ||
| - | / | ||
| - | [root@hpc-ilri weblab]# 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 / | ||
| - | * < | ||
| - | 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. | ||
| - | |||
| - | === Extracting the entire partition === | ||
| - | It's probably mostly empty space (remember, this is a raw dump of another hard disk), but if you want the raw partiton for duplicating to a physical disk or something, extract it to somewhere where there is a lot of space available: | ||
| - | * < | ||
| - | |||
| - | ==== Adding a bootloader to /boot ==== | ||
| - | |||
| - | The MBR needs 512 bytes at the beginning of the disk/image for the boot loader code (GRUB) and the partition table. | ||
| - | * < | ||
| - | Then prepend the image of the boot partition with the embty mbr.raw: | ||
| - | * < | ||
| - | |||
| - | ==== Copy boot data ==== | ||
| - | 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, create an empty 100 meg image: | ||
| - | * < | ||
| - | 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: | ||
| - | * < | ||
| - | [root@manatee2 alan]# losetup -f weblab_boot_new.raw</ | ||
| - | Now create a file system on the image' | ||
| - | * < | ||
| - | Then mount the image' | ||
| - | * < | ||
| - | Mount the original boot image: | ||
| - | * < | ||
| - | Copy everything over using cp's archive functionality (preserving time, date, permissions, | ||
| - | * < | ||
| - | Unmount both images: | ||
| - | * < | ||
| - | [root@manatee2 alan]# 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 [[weblab# | ||
| - | |||
| - | ===== 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 ''/ | ||
| - | |||
| - | ===== 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.1251707201.txt.gz · Last modified: (external edit)
