2

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.

Kyle
  • 351
  • 1
  • 2
  • 8

3 Answers3

5

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).

EEAA
  • 108,414
  • 18
  • 172
  • 242
  • 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 04 '11 at 01:38
1

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.

eFloh
  • 121
  • 2
0

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!

Tom Shaw
  • 3,702
  • 15
  • 23
  • 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 04 '11 at 19:03
  • @Kevin: [Really?](http://forums.fedoraforum.org/archive/index.php/t-261300.html) If it did, I expect they were pseudo-devices that don't really correspond to physical devices. – Tom Shaw Jun 05 '11 at 00:14