Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I know i can make my script run at boot time in runlevel 2 by putting it in /etc/init.d/ and creating a symbolic to it in /etc/rc2.d but thats when Linux is on hard drive.

I want to run my script from a flashdrive such that when a user plug in a flashdrive and powers ON the machine, it may start booting from the OS in flash drive and eventually executing my script.

How can I achieve such a functionality?

I have tried burning OS to flashdrive but I never succeeded in booting OS from flashdrive.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

You can boot linux from the flashdrive -- does that solve your question?

share|improve this answer
Actually No it doesn't. I need a very small size linux image or something(not Karmic Koala) which I can customize such that it's init.d has myScript in it and then I may be able to burn that image to my Flashdrive. And when I boot from flashdrive myScript should run at boot up. I hope my question makes some sense. I made a Live CD which does exactly this, using 'Finnix' (a Linux distro) but I am unable to make Finnix boot from flash drive. Their finnix-thumbdrive utility does not work at all. – usajbalt Feb 15 '10 at 4:54

Your question seems like two questions: how can I boot off a flash drive, and how can I run a script while its booting.

Flash Drive Booting

The ability to boot off a flash drive is dependent upon whether the hardware supports booting from USB. Its common on newer hardware, not so common on hardware that is two or three years old.

Init Script

On Debian, I use /etc/rc.local to run simple shell scripts.

For more information, check out NODOWS and Mindeb, the sites have lots of notes on creating small distribution sizes using SquashFS:

Hope that helps!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.