moving /var to its own partition


I found an interesting post concerning frequent HD-writes due to kjournal and pdflush:
Too much HDD activity - openSUSE Forums

Presently, I have only a root and a home partition with ext3. To follow the advice in the above link, I would have to create /var and /tmp with the ext2 fs.
Now, I did the obvious thing and created them and inserted the mount information in /etc/fstab.
The problem, however, is that the mount comes apparently too late and the kernel writes into /var on the “/” partition already before the /var partition gets mounted. The result is that the entire system does obviously not work properly.
does anyone know how I can make sure that the /var partition get mounted early enough?

thanks in advance,

It should work, the mount should be done while the system is still running in RAM. What is the line you have in /etc/fstab?

Yes ,this was my intuition, too.
But it didn’t work… Should it work this way, are you sure?
Shouldn’t grub be aware of the file systems that should be mounted during booting?

I forgot: The line in /etc/fstab:

/dev/disk/by-id/ata-ST9160823AS_5NK1GCZ9-part9 /tmp ext2 acl,user_xattr 1 2
/dev/disk/by-id/ata-ST9160823AS_5NK1GCZ9-part8 /var ext2 acl,user_xattr 1 2

No, grub doesn’t have to be aware of it because grub doesn’t need to know about it, only the root and boot filesystems.

Even if some files are created in /var that’s in / before it is mounted, that should not block the mount, it just obscures the files already there. What makes you say that the kernel writes into /var (in /) before the mount? The kernel itself doesn’t do any file I/O, but the logging system might.

If there is anything in /var (in /) it will be obscured by the mount. Anything you wanted to keep should have been copied over to /var (in its own partition). In other words /var should just be an empty directory before mount, and then connected to /dev/sda8 (I think) after the mount.


this sounds intuitive, and I’d say i agree to what you say.
But it does not work :-((
I have tried both: using a) a clean /var partition and b) copy everything from the old var on the root partition (let’s call it “r_var” ) to the new /var partition.

When I boot the kernel with the setup you suggest then the most visual effect is that it does not start the xserver.
Furthermore, in the kernel output one can see error messages (see below for some of them). It seems that some files are written to r_var before the /var partition gets mounted. Then, these lost files cause the error.

any clue?


Initializing random number generator/etc/init.d/random: line 41: /var/lib/misc/random-seed: No such file or directory
chmod: cannot access `/var/lib/misc/random-seed’: No such file or directory

Re-Starting syslog services/etc/init.d/syslog: line 166: /var/lock/subsys/syslogd: No such file or directory

Starting smartd /var/spool/cron: No such file or directory

Starting libvirtd done
bind: No such file or directory

It looks more like your new /var doesn’t have all the files and directories that were in the old /var. Looks like despite what you said, you did not copy all the old /var files to the new /var.

it sure does. but what else can I do than just copy from one dir to another…trivial enough, isn’t it?

but, dohh(!!), I simply copied again and now it works…


I am not sure what went wrong: from visual inspection, all files were there (and it wasn’t like I copied “var” into the new direcory)…
but I checked in detail for the earlier mentioned missing files only after the final copy, and they were there of course. Anyway, it works now, thanks!


The correct way to do it would have been to start up the system in single user mode, or to boot up a rescue system and copy the old /var to the new /var. You might have missed some files and directories doing the copy on a live system.