But this way has two major problems:
1) existing data on the usb will be ruined;
2) the remaining space of a larger usb cannot be utilized;

since I have a 8GB usb stick and have used over 2GB to save some stuff; I want to make it to run Gentoo LiveDVD but don't want to ruin existing data
to files on this usb organized clean, I don't want to just extract all files of the iso into root of the usb; I made it this way;
1) create a named "gentoo" folder in the usb;
2) copy Gentoo LiveDVD 2012.1 iso into this "gentoo" dir;
3) extract "boot" and "isolinux" from iso into this "gentoo" dir;
4) rename all "isolinux" to "syslinux", isolinux.bin to syslinux.bin, isolinux.cfg to syslinux.cfg;
5) # syslinux -d /gentoo/syslinux /dev/sdb1

After that, this usb becomes bootable usb; if you try boot with this, it can show same bootmenu as running from cdrom, but if you really boot some entry, it would fail at some later linux booting step;

So we need to change the syslinux.cfg entry, I just show the first one as example

Some explains:
1) the kernel file "/boot/gentoo" I didn't put them into root dir of usb, so I choose relative parent dir of where syslinux.cfg exists; some reason apply to "initrd="
2) I don't know why "root=/dev/ram0 init=/linuxrc" exists there, it's just not required, and is default value by initramfs;
3) I use default us keymap, so removed dokeymap;
4) "aufs looptype=squashfs loop=/image.squashfs" also can be automatically detected, also removed;
5) I use "aufs_mem=2G" for better 3D desktop experience;
6) I use "cdroot=LABEL=PENDRIVE" to tell initramfs to find real cd root; the "PENDRIVE" here is my sdb1 vfat volume label, you can change it to your own;
7) add "isoboot=gentoo/gentoo12.iso" that's where I put iso in the usb;
"doload=ehci-hcd,usb-storage" for some rare case where driver for the usb stick is not automatically loaded;
9) you can keep the old gentoo.igz as initrd, or I have some changes to "/init" and "/etc/initrd.scripts" inside the initramfs, as well I repacked it with xz for better compression ratio;
these changes to initramfs are to better support usb;

without these changes you won't be able to access other files in the same usb stick, where other features provided by the LiveDVD are the same;
I made some changes to initrd to make the live desktop be able to access files in the usb stick, here is the diff

So finally I made a perfect usb stick that can boot Gentoo LiveDVD with capability to save data in the same usb, also I have put required nonfree b43 firmware as firmware.tar under "gentoo" of the usb; that it could drive my HP laptop wireless automatically; with remaining free space of the usb, I can even save a movie there; take one usb, play everywhere

if anyone need the prepared modified "gentoo12.xz" initramfs file, I can upload it somewhere, with xz compression, it's now 7.9MB; know where has a good place to paste binary file?_________________"One of my most productive days was throwing away 1000 lines of code."
- Ken Thompson.

kudos, I would suggest maybe getting this moved to Documentation, Tips & Tricks?_________________A process cannot be understood by stopping it. Understanding must move with the flow of the process, must join it and flow with it.

the 1st code changes in the link is technically not required since syslinux boot menu give you a chance to change it during runtime:

So, with the above gentoo.igz, the steps to make a bootable usb is:
assume it's sdb1 mounted somewhere (I have only vfat usb, don't want to try reformat, but I think both vfat, ntfs, or extX series most linux file system would be supported );
1) create a named "gentoo" folder in the usb;
2) copy Gentoo LiveDVD 2012.1 iso into this "gentoo" dir;
3) extract "boot" and "isolinux" from iso into this "gentoo" dir;
4) copy above made gentoo.igz or gentoo.xz into this /gentoo/boot/ dir, to replace the original one copied from iso;
4) rename all "isolinux" to "syslinux", isolinux.bin to syslinux.bin, isolinux.cfg to syslinux.cfg;
5) # syslinux -d /gentoo/syslinux /dev/sdb1

These steps could be script-able in future;

Then for this usb, we never touched any other contents outside "/gentoo/" and make it bootable now: you can try boot with it, but if you didn't change syslinux.cfg, you need to change parameters on runtime, for syslinux running, Press 'Tab' to change it:

This is what I tested running well, but not all required:
1) ../boot/gentoo is required because this kernel file is not put in the
root of the usb, you can use the absolute name "/gentoo/boot/gentoo" ok,
or this style of relative path, syslinux is reading that according
where syslinux.cfg exists, "/gentoo/syslinux/syslinux.cfg" is where
I saved it, so this relative path "../boot/gentoo" works for me;
2) "root=/dev/ram0 init=/linuxrc" is not required at all,
it's no use but no harm;
3) aufs_mem=2G, adjust according how much memory do you have on your machine;
4) cdroot=LABEL=PENDRIVE, PLEASE change to your actual usb device name,
you may use like "cdroot=/dev/sdc1", but it may be different for each time
so you may want to use your file system label, like I'm using
"PENDRIVE" as vfat label for my /dev/sdc1;
5) isoboot=gentoo/gentoo12.iso, when I copied the iso, I just renamed it to
this shorter name, please change it to your actual iso name,
this is relative to root of the usb; because it's read by linux init scripts
6) initrd=../boot/gentoo12.xz, use relative same as above "../boot/gentoo" change;
please point to your actual re-made gentoo12.igz filename;
7) doload=ehci-hcd,usb-storage, to make sure usb-storage kernel module load,
since I was using "nodetect" to save time booting;

After this boot and user login, the usb content is available in Nautilus or other similar file manager, mounted at "/mnt/iso" by init scripts, this is kind of confusing, but I was trying to keep above changes to init scripts as minimum,

And "/mnt/iso" is default by init scripts mounted as read-only, the user could sudo "mount -o remount,rw /mnt/iso" to make it read-write; and I have another change in init scripts to make it default read-write;

The "/mnt/iso" is not umount-able since the actual gentoo12.iso is loop mounted from there, and layered with a tmpfs to the runtime root;

Thanks!_________________"One of my most productive days was throwing away 1000 lines of code."
- Ken Thompson.

this is totally awsome!
Because in a new verison livedvd --- gentoo 20121221 ,the end of world edition, when i try to make a liveusb by using unetbootin, it can not display a graphic menu;
while by using official dd method, windows xp can't use it anymore,even if you add a new partition and format it into fat32.

Your method is absolutely right! By using the iso as a whole and replace isolinux with syslinux and pass right args to kernel, it works! And I think it is a universal way to make liveusb (I'll try that later).

Now I want to write a little more notice here:
1) use the same syslinux version all the time: syslinux version 4 and 5 are a lot different. and the origin iso is using isolinux 4.05. But I am using syslinux 5.00 and it works.(no test for syslinux 4.x)
2) in order to make usb bootable, dd a syslinux-provided mbr to your /dev/sdX:
dd if=/usr/share/syslinux/mbr.bin of=/dev/sdb
3) if you get a error like me : failed to load vesamenu.c32
"failed" instead of "not found"
Here is important:
cp /usr/share/syslinux/*.c32 /mnt/usb/gentoo/syslinux/
because in syslinux-5.0.0, some of these .c32 files are dynamic linked.

Good Luck and enjoy the best livedvd on the planet!!

UPDATE:
A little more thing:
1) it seems that ONLY when you prepare your partition on usb disk in linux is OK. no windows, no ntfs. USE FDISK ON LINUX!
2) For a USB flash drive, windows can only recognize it's first partition, so, prepare a large fat32 partition for iso storage and windows storage and a second ext partition for live-linux storage.
3) to make it bootable,
fdisk /dev/sdX
a [stand for active]
1 [partition number which .iso is in, highly recommend 1]
w
q

Hey crquan, tnx for the great tip. I'm trying your method right now with new Gentoo 20121221 LiveDVD - End Of World Edition http://www.gentoo.org/news/20121221-livedvd.xml
I did everything that you advised except some changes:
4) I didn't rename isolinux default path into syslinux path. I only renamed isolinux.bin to syslinux.bin and isolinux.cfg to syslinux.cfg.
5) I used slightly different syslinux command:

Code:

syslinux.exe -maf -d /gentoo/isolinux h:

(I'm trying to make ntfs flash usb stick on Windows with cygwin and other tools. That's why you see .exe in some commands.)

[*] gentoo.igz on new Gentoo 20121221 LiveDVD has been already packed with xz. So, the algorithm of modifying this file is the following now:

[*] init and /etc/initrd.scripts files were changed in this release. I'm trying to make your changes correct but cannot ATM mount cdrom (flash) after booting from the flash. It gives me the following errors:

Code:

>> Attempting to mount media: /dev/sdd1
!! Media not found
...
Could not find the root block device in .

should have listed all the block devices that the kernel found, just before the full stop.
In your case, the list is empty, that means that no device drivers for your block devices are available to the kernel._________________Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.

So, you say that the kernel has no drivers for this usual USB flash with ntfs filesystem? It's standard USB 2.0 Flash Transcend 16 Gb JetFlash 600, 620 High-Speed stick. What should I do? Is it happen because of ntfs? Should I try to format my flash stick to fat32 and try again?

Its unlikely the kernel ntfs drive is present because nobody uses it. At one time it was very dangerous to ntfs file systems. That was 'fixed' by reducing its write capabilities to changing the content of existing files, provided the file size was unchanged. Everyone that needs ntfs now uses ntfs-3g. ntfs-3g is a user space application that depends on the kernel providing FUSE support.

For ntfs to work, you need ntfs-3g in the initrd. In place of ntfs in your mount command, try -t ntfs3g and -t ntfs-3g, since I'm not sure if the filesystem name gets the hypen or not.
I think its unlikely that ntfs-3g will be in the initrd so it may still fail.

You have a much better chance with vfat.

Why do you put a journalled fs, like ntfs, on a FLASH stick. The journal accesses are bad for speed and FLASH life._________________Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.

OK, I'll try to use ntfs-3g or vfat. This flash was formatted by some guy in my uni when fat32 couldn't eat dvd iso file with more then 4Gb space. I think that journalling for flash disk is bad too because of it's limited number of rewrites in comparison with HDDs. But fat32 is dying filesystem too.

Adding "aufs looptype=squashfs loop=/image.squashfs" back to syslinux.cfg doesn't help me too. I tried to analyze init scripts in gentoo.igz. And it looks like there's an error in above patch. It should be

Code:

if [ "${LOOP}" = '' -o ! -e "${CDROOT_PATH}/${LOOP}" ]

instead of

Code:

if [ "${LOOP}" = '' -o ! -e "${NEW_ROOT}/${CDROOT_PATH}/${LOOP}

because /newroot/mnt/cdrom/ doesn't mount before that check. But /mnt/cdrom (${CDROOT_PATH}) mounts before this loop check in the script.
I changed that string and tried to boot again. LOOP error disappeared. But kernel hangs this time with a following message:

I tried to search forums with "export loop valid location " and found the following post:

Quote:

I unpacked the initramfs, added the isofs module (since genkernel doesn't put that in automatically?) and created an entry for it in /etc/modules/fs. Now my ISO boots up fine in QEMU without any intervention!

I don't see isofs there. I can't find isofs module inside lib\modules\3.6.8-gentoo-r1\ of that gentoo.igz too. If I try to add isofs into doload list of syslinux.cfg kernel hangs without any messages (black screen and two keyboard indicators are blinking).

Why does kernel hangs? Am I did smth wrong? Any advices on that message?

I think I understood the problem. This file is probably a symlink. I was repacking gentoo.igz file in Windows on ntfs filesystem. That's why symlinks probably weren't exported correctly? If it is then I have serious problem. Where will I find ext2 filesystem for example without linux livecd at least?

is the error. That's the init script the kernel tries to run to bring the system up.
Its claiming its not there. Is it there a problem with exec permissions, either on the file or on the filesystem ?_________________Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.

I will check exec permissions. I repacking gentoo.igz in cygwin. I thought that symlinks isn't supported by ntfs in linux way, but now I think that probably cygwin should emulate somehow linux symlinks in proper way.