Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

My almost empty fstab:

none    /dev/pts        devpts  rw      0       0

I'm trying to use noatime for three directories on my server /home, /tmp, and /var

df -l gives:

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/simfs            10485760   5914472   4571288  57% /
none                    524288         4    524284   1% /dev

So I figured this is how it's done. I add the three entries below into my fstab:

/dev/simfs      /home   ext3    defaults,noatime,usrquota       1 2
/dev/simfs      /tmp    ext3    defaults,noatime,noexec,nosuid  1 2
/dev/simfs      /var    ext3    defaults,noatime,usrquota       1 2

After I save the changes--when I try to remount the drive this happens:

[root@horizon ~]# mount -a -o remount
mount: /home not mounted already, or bad option
mount: /tmp not mounted already, or bad option
mount: /var not mounted already, or bad option

May someone please help me figure out what's wrong with my /etc/fstab?

Thank you.

share|improve this question

3 Answers 3

up vote 5 down vote accepted

To answer your question directly, there's nothing wrong with your fstab.

You can't just add entries to your fstab willy nilly. This file is there for you to intruct the OS which disk partitions to mount, and to which locations in the filesystem.

If you want to create different mount options for /home, /tmp, and /var, then you will need to create three partitions for them, copy the data over, and then mount them.


Edit: Looks like /dev/simfs is a OpenVZ thing. So this is a OpenVZ VPS you're attempting to do this on correct? If so, you'll likely need to work with your provider to see if this is even possible. They may not allow you to create new disk images (partitions).

share|improve this answer
    
LOL willy nilly... Also your right. My vps host is using OpenVZ. I'll ask them if they can do the changes since I can't really add any partions. –  Kyle Jun 4 '11 at 1:38

Just to clarify the other answers (cannot comment yet): in /etc/fstab you state what disk partition will be accessible in which directory. So this is a mapping from partition to directory.

In your case, you have only one disk partition (/dev/simfs), so you can only have one mount point for this in /etc/fstab.

What you whant to achieve is to use different partitions so you can define other mountpoints in order to set special mount options. But there is a little (but imperformant) workaround in case you really cannot use actual partitions: the loop device. This enables you to mount files as devices.

So you could create and use 3 files for the "partitions" home, tmp and var. e.g:

  • dd if=/dev/zero of=/usr/local/vdisks/home.filesystem bs=1M count=1024
    this will create a 1GB file for "home"
  • mkfs.ext3 /usr/local/vdisks/home.filesystem
    this will "format" your new file system with ext3
  • append /usr/local/vdisks/home.filesystem /home ext3 defaults,noatime,usrquota,loop 1 2 to your /etc/fstab
    this will mount the file system inside the file as /home

But keep in mind that this really is not a solution with great performance, nor will the ext3 journalling actually be useful, as the data and the journalling information will be written as "data" when the data of your actual underlying file system (/dev/simfs) is written.

share|improve this answer

Trying to mount the same block device (e.g. /dev/simfs) in multiple locations at the same time is a shortcut to filesystem corruption. You're lucky your OS didn't let you do this!

share|improve this answer
    
My freshly installed Fedora 15 system did this automatically, and inseveral places. However, it also presented different files(the correct ones) in different places. –  Kevin M Jun 4 '11 at 19:03
    
@Kevin: Really? If it did, I expect they were pseudo-devices that don't really correspond to physical devices. –  Tom Shaw Jun 5 '11 at 0:14

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.