1

I have a local site for accessing data on virtual drives. To do so I created a few directories inside my /var/www/ and a simle html file to access the starting pdf or htm* files on those virtual drives that are intended to be used as local catalogs on CD/DVD. I also must say, file that is being mounted is on a NTFS partition.

cd /   
sudo mount "/media/Video/Virtual Drives/file.iso" /var/www/dest_folder

First time when I enter it, I get an error that the source location does not exist, but when I use file browser to go to the /media/Video/Virtual Drives/ folder. After the visit command functiones.

When I entered all the mount commands manualy that was not a big problem, but now I created a sh script for seven differnt iso files and insterted it in init.d to automaticly start, now I have a problem because the script does not work.

Ubuntu version is 12.04LTS

Can you help?

Regards, SaleB

  • is /media/video/virtual drives itself a mount ? If so you need to use the second mount AFTER – exussum Jun 13 '13 at 11:59
  • Yes, that was primary problem, when I added the ntfs partition into fstab, everything started working – SaleB Jun 13 '13 at 13:17
  • added it as an answer – exussum Jun 13 '13 at 13:21
3

Use the following command, plus escape the whitespace:

mount -o loop /media/Video/Virtual\ Drives/file.iso /var/www/dest_folder

If i recall correctly you need the loop option, i have never tried it without that option.

Update:

Or add the following to /etc/fstab to automount on startup, since that is the thing you actually need.

/media/Video/Virtual\ Drives/file.iso /var/www/dest_folder iso9660 loop,ro,auto 0 0

hth

  • Thank you for your answers. Yes it is a loop virtual path. I will try it tomorrow. I have found a part of the problem why it did not work. I have inserted the ntfs partition into /etc/fstab and now all works. I have added the sh file into some folder in /etc/ and now all works fine. After a restart I have all loop drives visible form /var/www/ – SaleB Jun 13 '13 at 13:05
  • But there is in commands no more sudo because those sh files in that folder already execute with root privileges – SaleB Jun 13 '13 at 13:15
  • You can mount the iso directly using the /etc/fstab. That way you don't have to invoke some script manually when starting up. I have updated my answer. Just use mount -a after you added the iso, to mount all the entries described in /etc/fstab. – ortang Jun 15 '13 at 9:12
2

you need to escape spaces in path

sudo mount "/media/Video/Virtual\ Drives/file.iso" /var/www/dest_folder

  • Why? - IOW: please elaborate why the additional escaping is needed, even though the file is already between quotation marks ". – Patrick B. Jun 13 '13 at 10:01
  • spaces in paths must always be escaped by \ in commandline, an easy way of handling this is using the autocomplete function of the commandline by using the tab-Key the "" have on effect on the escaping of spaces – quidage Jun 13 '13 at 10:08
  • That's not true. If you autocomplete with " in bash it will do it without backslashes - and it will work. – Patrick B. Jun 13 '13 at 10:13
  • 1
    In fact the additional backslashes here are needed because of the use of sudo. Running sudo cmd "file\ text" will make the space go correctly the cmd after sudo has switched. – Patrick B. Jun 13 '13 at 10:15
  • you are right! shame on me! – quidage Jun 13 '13 at 10:17
0

is /media/video/virtual drives itself a mount ? If so you need to use the second mount after this folder has been mounted successfully

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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