-2

My server is running out of hard disk space. The main reason is a huge amount of archived IMAP mails. Therefore my idea was to put all archived mails on my NAS and mount that folder on my server.

Here is my setup:

NAS - example.nas

popuser@nas:/root> id
uid=110(popuser) gid=31(popuser) groups=100(users),31(popuser)

A folder /media/data/ARCHIVE/, were the popuser has rw access.

Server - example.com

popuser@server:/$ id
uid=110(popuser) gid=31(popuser) groups=31(popuser)

The IMAP folder /var/qmail/mailnames/example.com/info/Maildir/, were the popuser has rw access.

sshfs mount

As popuser on the server, I created a folder called .ARCHIVE in the IMAP folder as the mounting endpoint. As popuser I am mounting the NAS folder as follows:

SRC=/media/data/ARCHIVE/
MNT=/var/qmail/mailnames/example.com/info/Maildir/.ARCHIVE/
sshfs -o allow_other -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null popuser@example.nas:$SRC $MNT;

As popuser I created the following IMAP folder structure:

mkdir -p $MNT/{cur,new,tmp}

As soon I click on ARCHIVE in thunderbird, I get the following error:

Oct  8 20:40:33 server imapd: Failed to create cache file: maildir_lock (info@example.com)
Oct  8 20:40:33 server imapd: Error: Input/output error

On the server, I can create/delete files within the mounted folder as root and as popuser.

I have no clue what forces the error.

Dennis
  • 128
  • 7

1 Answers1

3

sshfs is an extremely poor choice for this because it doesn't offer a lot of the features "real" file systems give you, like reasonable locking. This is because it simulates a normal file system with a backend that can't handle all the requirements.

If you use a NAS, it can most likely handle NFS. Use this, it's a much better choice (and even then, you can run into a lot of trouble).

Sven
  • 97,248
  • 13
  • 177
  • 225
  • The NAS is in my local network and here I am using NFS quite a lot. I will try to tunnel NFS over SSH. – Dennis Oct 08 '14 at 19:23
  • 4
    This sounds insane. Instead of this kind of frankenstein setup, consider if you really need access to the whole archive via IMAP or if you can setup e.g. a Thunderbird archive on the NAS or a local IMAP server in your network just for the archive. Bonus points for the real solution: Add disk space to the primary server. – Sven Oct 08 '14 at 19:34