PDA

View Full Version : running commands on startup ?



teishu
6th February 2007, 10:31 PM
how can i get fedora to run the following as soon as it boots/logs in ?

mount -t vfat /dev/hdb1 /mnt/backup

how would this work when i log into a non root account ?

b_martinez
6th February 2007, 10:40 PM
teishu,
the easiest way to do that is to have it in /etc/fstab file.
Add the following line


/dev/hdb1 /media/backup vfat user,rw,nosuid,noguid 0 0

[The last two symbols are zeros, not letters.]

Before you do this, as root make a directory in /media to open the partition in.


su -
(enter root password here)
mkdir /media/backup
updatedb
exit
exit

hth
Bill

edit: this way allows users to read/write to the partition /dev/hdb1
Bill

brunson
6th February 2007, 11:17 PM
why updatedb?

Dies
6th February 2007, 11:26 PM
why updatedb?

LOL.

Planning ahead, maybe? :confused:

b_martinez
6th February 2007, 11:49 PM
I usually update data base any time I change any .conf file. Habit , I guess.
Bill

teishu
8th February 2007, 12:01 AM
teishu,
the easiest way to do that is to have it in /etc/fstab file.
Add the following line


/dev/hdb1 /media/backup vfat user,rw,nosuid,noguid 0 0

[The last two symbols are zeros, not letters.]

Before you do this, as root make a directory in /media to open the partition in.


su -
(enter root password here)
mkdir /media/backup
updatedb
exit
exit

hth
Bill

edit: this way allows users to read/write to the partition /dev/hdb1
Bill

hi ive done exactly as you have said and it dosen seem to mount it.
If i type: mount /dev/hdb1 /media/backup

it works, but with the vfat in it it dosenīt. Can i remove the vfat from the fstab file? or is ther a different solution ?

thanks

Duli
8th February 2007, 12:06 AM
hi ive done exactly as you have said and it dosen seem to mount it.
If i type: mount /dev/hdb1 /media/backup

it works, but with the vfat in it it dosenīt. Can i remove the vfat from the fstab file? or is ther a different solution ?

thanks
Try replacinf vfat with auto in the fstab.
Duli

teishu
8th February 2007, 12:08 AM
Try replacinf vfat with auto in the fstab.
Duli

ok, ill try this and report back.. thanks

teishu
11th February 2007, 01:26 AM
ok tryed that and it still dosen't mount it :S any more ideas ? On boot up it says FAILED next to the Mounting drives bit..

Dies
11th February 2007, 01:33 AM
su -
mkdir /backup
chmod -R <your user name> backup

and edit your fstab to reflect that change by removing the /media part and adding back the vfat instead of auto then reboot to see what happens.
Not sure why it would but you can also check to see if Selinux is interfering by looking at the logs or just setting it to permissive then rebooting.

teishu
11th February 2007, 01:36 AM
su -
mkdir /backup
chmod -R <your user name> backup

and edit your fstab to reflect that change by removing the /media part and adding back the vfat instead of auto then reboot to see what happens.
Not sure why it would but you can also check to see if Selinux is interfering by looking at the logs or just setting it to permissive then rebooting.

ok i'll give it a go

teishu
11th February 2007, 01:48 AM
Says: Wrong FS type

teishu
11th February 2007, 01:55 AM
is there another way of running:

mount /dev/hdb1 /backup

at start up ?

Dies
11th February 2007, 01:55 AM
LOL, are you sure it's FAT?
Doesn't make much sense, since you said you can mount it manually with that command, right?

Just for sh*ts and giggles:

yum install gparted ntfsprogs -y

Then open gparted it will be in Applications>System Tools>, select the drive in the upper right hand corner and see what it's recognized as. Post a screenshot.

teishu
11th February 2007, 02:07 AM
Well here is the result of sfdisk -l:


Disk /dev/hda: 155061 cylinders, 16 heads, 63 sectors/track
Warning: The partition table looks like it was made
for C/H/S=*/255/63 (instead of 155061/16/63).
For this listing I'll assume that geometry.
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End #cyls #blocks Id System
/dev/hda1 * 0+ 12 13- 104391 83 Linux
/dev/hda2 13 9728 9716 78043770 8e Linux LVM
/dev/hda3 0 - 0 0 0 Empty
/dev/hda4 0 - 0 0 0 Empty

Disk /dev/hdb: 238216 cylinders, 16 heads, 63 sectors/track
Warning: The partition table looks like it was made
for C/H/S=*/255/63 (instead of 238216/16/63).
For this listing I'll assume that geometry.
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End #cyls #blocks Id System
/dev/hdb1 * 0+ 14945 14946- 120053713+ c W95 FAT32 (LBA)
/dev/hdb2 0 - 0 0 0 Empty
/dev/hdb3 0 - 0 0 0 Empty
/dev/hdb4 0 - 0 0 0 Empty

and here is a screenie of gparted:

http://www.teishu.ndnhost.com/imgserv/data/media/1/gparted.png
(at the moment i've mounted it to /drive2 as its my second drive... thats what i have in my fstab file.

sorry i haven't cropped it..

Dies
11th February 2007, 04:00 AM
Hmm, and setting Selinux to permissive makes no difference either, huh?
That's crazy, it has to be something to do with the options then.

It might almost be easier to just use NTFS, lol.

I guess you could use a script to do it instead of fstab, but it's got to be something really silly stopping it from mounting at boot.

teishu
11th February 2007, 10:50 AM
Hmm, and setting Selinux to permissive makes no difference either, huh?
That's crazy, it has to be something to do with the options then.

It might almost be easier to just use NTFS, lol.

I guess you could use a script to do it instead of fstab, but it's got to be something really silly stopping it from mounting at boot.

OK thanks anyway..