1

I'm trying to mount an iscsi virtual disk, but if I execute the command through the exec function in php this give me that error: mount: special device /dev/sdf1 does not exist. But if I run the command directly in the console it run well!! What can I do? I'm obtaining the /dev/sdf1 in a good way, and it exists, but only through php doesn't work.

Thanks

I'm running the command with sudo and run it in console as www-data user always with sudo, so, I suppose that is the same enviroment.

sudo mount -t ext3 /dev/sdf1 /san_disks/RIBS_2

The sudoers file has this lines:

www-data    ALL = (root) /usr/bin/iscsiadm, /bin/mount, /bin/umount
%www-data ALL=NOPASSWD: ALL

And it works in console.

Mitch Dempsey
  • 38,725
  • 6
  • 68
  • 74
ldcl289
  • 41
  • 1
  • 8
  • 1
    Elaborate "in a good way". Also consider mod_chroot, suexec+fastcgi environment. – mario Dec 15 '10 at 23:17
  • 2
    your php code probably doesnt have the right permissions to execute that command, check the previliges for apache, and the user through which it runs. – tHeSiD Dec 15 '10 at 23:18
  • do you have safe_mode turned on? – damir Dec 15 '10 at 23:28
  • 2
    [Update][1] See my answer. It may be a timing issue. AFter creating the iSCSI device, it takes a second or so for it to appear. Adding a pause will allow mount to work. [1]:http://stackoverflow.com/questions/4465466/exec-doesnt-found-a-file/4465528#4465528 – frayser Dec 18 '10 at 13:48

1 Answers1

0

This was happening because "/dev" wasn't updated. I made a sleep(1) and it works!!

ldcl289
  • 41
  • 1
  • 8