You are not logged in.
- GOAL
Running ArchLinux 2009.02 on an USB Drive in Windows. Slow? Perhaps. Personally, I think it is actually pretty fast. Though
I must admit that I don't use funky things like X-windows (KDE, Gnome or something else), it was still pretty fast for a
complete OS running from an USB stick within(!) another OS.
So why would you want to do this? It's quite simple, actually. For me, the problem was that I always had to use Windows (XP)
at my work and wouldn't be able to boot into Arch there using a LiveCD or USB, thus being unable to use all my applications.
Perhaps you ARE able to boot into Linux at your work, but still, it can become quite frustrating to have to boot into another
Operating System all the time. With this, you don't have to do that anymore, you can run all your Linux applications IN
Windows!
- REQUIREMENTS
- Download QEMU 0.9.0 for Windows
- Download ArchLinux 2009.02 (later versions will probably work, but I used this version)
- An empty CD
- An USB drive of at least 4GiB
- GETTING ARCH
The first thing you should do once you have downloaded ArchLinux (a task that could take a while, depending largely on the
speed of your internet connection,) is to burn it to a CD. Perhaps it's different with you, but for me, QEMU wasn't able to
use the CD-image of ArchLinux properly without it being burned to a CD and being in the real CD-drive. Yes, I know this sucks,
because this means the installation of ArchLinux on your USB drive is going to take even MORE time, but I'm afraid it won't
work otherwise. (It didn't work with me, at least, perhaps it is different if you are using a different version of Arch, feel
free to contact me if this is the case.)
- SETTING UP QEMU
Once you have downloaded and unzipped QEMU, you have to create a disk image using qemu-img.exe. Fire up a terminal, and run
"qemu-img.exe create harddisk.img 4000M". This will probably take some time. (Assuming you are doing this on your USB drive,
if you're not, you still have to copy the file to your USB drive someday, so don't think you've bypassed the test of patience!)
When it's done, you will have a nice raw image file of 4000 Megabytes without any data in your folder, we are going to need
this later.
Now, to be able to boot the ArchLinux CD in QEMU, we have to modify the qemu-win.bat file a bit. Open the file, remove all
lines, and then write this: "qemu.exe -L . -m 512 -boot d -cdrom /dev/cdrom -hda harddisk.img" Now if you run this batch file,
it will start QEMU, allocate a maximum of 512MB RAM to the application (use less if you don't have that many, but I recommend
using as much as possible, since you don't want it to run TOO slow), boot from CDROM (-boot d) and use the /dev/cdrom to
locate the CDROM image, which should be your (first) CD/DVD-player. The -hda harddisk.img means it will use the file
harddisk.img as a hard disk drive (duh) which we are going to use to install Arch on. To go on, put the ArchLinux CD in your
CD/DVD-player, and run the batch file.
- INSTALLING ARCH
Installing ArchLinux is pretty straightforward, all you have to do is follow the instructions on the screen. There are a few
points you should keep in mind when installing ArchLinux on an USB drive, though.
- Don't create too many partitions! When using the 'auto-partitioner', Arch wants you to create seperate partitions for the
/ and the /home folder, I would not recommend doing this if you haven't created a harddisk image of at least 8000M. Because,
quite simply, otherwise you have to distribute the space (just 4000M) between / and /home, and it can be quite difficult to
allocate the right amount of space. Believe me, it IS a problem if you run out of space someday. You can't just create a
bigger harddisk.img file. (Well, technically you can, but that would be a little bit.. difficult for most people.)
- Don't select too many packages. Assuming you know what you're doing, try to deselect as much as possible (without screwing
up the whole thing, of course) for a very simple reason, you don't have that much space on a simple USB drive.
- Of course, you don't have to care at all about the above pointers if you have a very large USB drive. Very large here
meaning anything larger than 16GB, so yes, that IS pretty large in my opinion.
- SETTING UP QEMU, AGAIN
So you've installed Arch on your harddisk image, huh? Well done! In any case, we can't use the qemu-win.bat file anymore,
since we don't want to boot using the CD/DVD-player again. I recommend creating a new batch file in the QEMU folder,
(call it 'arch-hd.bat', or something like that,) and put the following line into it: "qemu.exe -L . -m 512 -boot c -hda
harddisk.img", the only thing that is changed is that we don't use the CD/DVD-player anymore, and that we changed the
it to -boot c which means it will boot from the harddisk image. (Actually isn't so difficult now, is it?)
- FINAL REMARKS
Now you're ready to go! You've installed ArchLinux on a Virtual Machine on your USB drive, so now the fun can start! One more
thing that I consider VERY important to know is how to mount your physical hard disk in Arch (in QEMU). Knowing this can make
it extremety-much easier to install things on Arch, since you can then simply 'download' the packages from your physical
hard drive.
To use your physical hard drive in QEMU, add "-hdb \\.\PhysicalDrive0" to the batch-file (arch-hd.bat), this line will assign
your first physical hard drive to /dev/hdb (or /dev/sdb) in Arch. Remember that you still have to mount it! (Someting that can
be done by writing "mount -t ntfs /dev/hdb1 /mnt/" in the terminal. Assuming your first hard drive uses the NTFS-format, and
the main partitions is /dev/hdb1, this should put all files and filders in /mnt/. It is possible that your partition is called
/dev/sdb1, in that case simply replace hdb1 with sdb1.)
Please keep in mind that there are many, many more parameters you can use in QEMU, so reading the documentation will probably
be a very good thing. You never know, you MIGHT even learn something!
- FREQUENTLY ASKED QUESTIONS
Q. When configuring the system in the ArchLinux installer, it just stopped doing anything when it was saving the configuration
files! Did it somehow crash?
A. No, this is normal. For some reason (called 'writing speed'), this just takes time. Much time. Lots of time. This is the real
test of patience.
Q. How do I get support for sound/video card/networking/etc. in QEMU?
A. Read the documentation!
Q. Help! QEMU crashed when I tried to run the .bat file!
A. Check whether you are using the exact same .bat file as given in the instructions. If it still doesn't work, contact me and
I will try to solve your problem if you provide me with enough information about it. (So sending me a message containing
something like "Help! QEMU doesn't work on my PC!" will probably not get you much of a useful response.)
Offline
Did you try qemu with kqemu for acceleration?
Offline
I have personally not yet tried it, as Arch was running quite smoothly without the need for extra acceleration. I will, however, test kqemu soon, as I want to know what the speed benefits are. I will let you know once I've tested that.
Offline
WIKIfy it!
Offline
So you liked it? I'm a little bit busy today, so it might take some time before I am able to do that (it wouldn't take that much work, though), so expect it to be on the Wiki in a few days.
Offline
The problem, I understand, is that kqemu and KVM need admin-level access from in Windows.
Otherwise, you're stuck with unaccelerated QEMU -- slooooow.
I just use ssh
Offline
i tried to boot my custimized larch iso image in qemu on windows host but failed on starting X. Xorg log did not mention anything specific :-(
Offline
thank you, quite useful. btw i had to use qemu 0.9.0 for installation - somehow i was unable to make 1.5.50 boot (from neither iso nor physical cdrom). but then i had to switch back to the newer version because i was getting a lot of libata2 exception messages on console. also, i had to update UUID for some reason in grub.cfg. performancewise it's not very fast but it fits my needs. i am using the following command to start my qemu archbox: qemu-system-i386.exe -boot c -hda harddisk.img -net nic,model=virtio -net user -redir tcp:5555::22 and then i can connect using putty on my local port 5555. the good thing about this is that you really don't need admin rights.
Offline
Not really my job to butt in here, but please don't necrobump.
Mostly relevant here on grounds of all the things that have changed in not only Arch, but qemu as well since the thread was made.
Currently running Arch on a Samsung Chromebook Pro (dual booted with ChromeOS), and various VPSes and Docker containers.
Offline