Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I created one partition and I wanted to mount that partition to this directory /home/max/VirtualBox VMs

I wrote this line in fstab:

/dev/sda4    /home/max/VirtualBox\ VMs  ext4    defaults        0 0

but it's giving this error

[mntent]: line 16 in /etc/fstab is bad

I know I am getting this error because of space in between 'virtualBox VMs'

Is it possible to mount to that Directory?

[max@localhost VirtualBox VMs]$ pwd
/home/max/VirtualBox VMs
share|improve this question
    
Are u shure created dir exactly as inficared in fstab. I saw a typo in question –  Yurij73 Jan 3 '13 at 10:00
    
yes it's created –  max Jan 3 '13 at 10:05

3 Answers 3

up vote 2 down vote accepted

Use quote marks.

/dev/sda4 "/home/max/VirtualBox VMs" ext4 defaults 0 0

share|improve this answer
    
Its not working I tried all these things "/home/max/VirtualBox VMs" , /home/max/VirtualBox\ VMs /home/max/"VirtualBox VMs" nothing is working. –  max Jan 3 '13 at 10:02
1  
You could try using \040 instead of the spaces; according to the internets that works fantastically; I just tried it on Arch running 3.7 kernel and it doesn't want to work for me however. –  Justin Jan 3 '13 at 10:12
    
great... Its working fine now... but what is \040 means? –  max Jan 3 '13 at 10:16
    
the \ is an escape character and 040 is the ASCII code for space. Now I want to know why it won't work for me :/ –  Justin Jan 3 '13 at 11:16
1  
That's interesting. Even the ArchWiki says in fstab # Filepath spaces that \040 should work. Does the quotes approach work for you? –  Dennis Jan 3 '13 at 13:20

fstab has its own syntax. To use spaces as part of a directory name, you have to specify its code point as a zero-padded 3-digit octal number, preceded by a backslash (escape character).

In ASCII, the space character's code point is 32 or 40 in octal, so you can use:

/dev/sda4               /home/max/VirtualBox\040VMs  ext4    defaults        0 0

Note that, while code points are supported for other characters as well, the support is rather flaky. On my machine, you can write \127 instead of W, but not \070 instead of 8...

share|improve this answer

In the question you say the name is

/home/max/VirtualVM Box

, in your example you show

/home/max/VirtualBox\ VM

It should be

/home/max/VirtualVM\ Box

to be the same. It should also have quotes around it.

share|improve this answer
    
sorry that was by mistake, I updated my question –  max Jan 3 '13 at 10:08

Your Answer

 
discard

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.