LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Detect usb stick at boot (https://www.linuxquestions.org/questions/linux-general-1/detect-usb-stick-at-boot-539230/)

nitinbaldi 03-21-2007 01:59 AM

Detect usb stick at boot
 
Can anyone help me on how to make my usb stick detected at boot time.
I need a file to be detected at the boot-up which is in the usb stick.
I came to know that I will have to make a device node and load some modules in the init file of the initrd.
Can anyone suggest how to make a device node for my usb stick (/dev/sda) in the init and which all modules
are needed to be loaded and how?
I am using fedora core 5.

Here is my fstab file
---------------------------------------------------------------------------
LABEL=/1 / ext3 defaults 1 1
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs defaults 0 0
LABEL=/home/user1 /home/user1 ext3 defaults 1 2
LABEL=/home/user2 /home/user2 ext3 defaults 1 2
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
LABEL=SWAP-hdd2 swap swap defaults 0 0
/dev/hdd5 /mnt/c vfat defaults 0 0
/dev/hdd6 /mnt/d vfat defaults 0 0
/dev/sda /mnt/e vfat defaults 0 0


And Here is my init file
---------------------------------------------------------------------------
#!/bin/nash

mount -t proc /proc /proc
echo > /proc/suspend2/do_resume
setquiet
echo Mounting proc filesystem
echo Mounting sysfs filesystem
mount -t sysfs /sys /sys
echo Creating /dev
mount -o mode=0755 -t tmpfs /dev /dev
mkdir /dev/pts
mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
mkdir /dev/shm
mkdir /dev/mapper
echo Creating initial device nodes
mknod /dev/null c 1 3
mknod /dev/zero c 1 5
mknod /dev/systty c 4 0
mknod /dev/tty c 5 0
mknod /dev/console c 5 1
mknod /dev/ptmx c 5 2
mknod /dev/rtc c 10 135
mknod /dev/tty0 c 4 0
mknod /dev/tty1 c 4 1
mknod /dev/tty2 c 4 2
mknod /dev/tty3 c 4 3
mknod /dev/tty4 c 4 4
mknod /dev/tty5 c 4 5
mknod /dev/tty6 c 4 6
mknod /dev/tty7 c 4 7
mknod /dev/tty8 c 4 8
mknod /dev/tty9 c 4 9
mknod /dev/tty10 c 4 10
mknod /dev/tty11 c 4 11
mknod /dev/tty12 c 4 12
mknod /dev/ttyS0 c 4 64
mknod /dev/ttyS1 c 4 65
mknod /dev/ttyS2 c 4 66
mknod /dev/ttyS3 c 4 67
echo Setting up hotplug.
hotplug
echo Creating block device nodes.
mkblkdevs
echo "Loading jbd.ko module"
insmod /lib/jbd.ko
echo "Loading ext3.ko module"
insmod /lib/ext3.ko
mkblkdevs
resume LABEL=SWAP-hdd2
echo Creating root device.
mkrootdev -t ext3 -o defaults,ro hdd8
echo Mounting root filesystem.
mount /sysroot
echo Setting up other filesystems.
setuproot
echo Switching to new root and running init.
switchroot

aus9 03-21-2007 04:34 AM

a normal usb stick has no bootloader in the mbr so if your bios detects it...it ignores it.

2) you can follow the suggestions in my signature if you want a bootable usb stick....but it is not clear to me that is your true aim.....is there some driver you want at boot due to a problem with your current distro?

3 it may be the case that FC6 is updated for your driver if that is the issue?

nitinbaldi 03-21-2007 06:27 AM

Actually I am using suspend2 to hibernate the system. In this, I create a file in which the snapshot of the memory is stored and then the system power downs. While resuming, that file is read and its contents are restored in the memory.
Now I have created above mentioned file in the usb stick. I want that when the system boots, initially the grub will be displayed. Then I choose the appropriate entry and load the kernel. At here, I want that the usb be detected and the file be loaded.
So summarizing, I want the usb stick to be detected at the boot time, after the grub stage i.e at the time when init loads. Hope this is sufficient...

aus9 03-22-2007 04:07 AM

why not use the swap file to have the hiberante/resume file?

2) well the thing is...I think .... we are not talking about a bios boot issue at all...we are simply have a hard drive in suspend mode...and your usb stick should already have been read and accessed for the file to be written



is that clearer?


3) boot time suggests you have rebooted or shutdown and down a cold boot and I think you mean something completely different


All times are GMT -5. The time now is 10:43 PM.