# Howto : move the mail directory from /var/mail to /home/mail

**URL:** <https://forum.yunohost.org/t/howto-move-the-mail-directory-from-var-mail-to-home-mail/2422>\
**Category:** Support\
**Created:** [February 3, 2017, 9:50pm UTC](https://forum.yunohost.org/t/howto-move-the-mail-directory-from-var-mail-to-home-mail/2422 "2017-02-03T21:50:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bachy](https://forum.yunohost.org/user_avatar/forum.yunohost.org/bachy/32/30_2.png) [@Bachy](https://forum.yunohost.org/u/Bachy)\
**Post date:** [February 3, 2017, 9:50pm UTC](https://forum.yunohost.org/t/howto-move-the-mail-directory-from-var-mail-to-home-mail/2422/1 "2017-02-03T21:50:40Z")

</div>

Hi,  
here is a little howto about moving the mail directory on yunohost  
my root partition was full while my /home partition had plenty of room, so i wanted to move the bigest folder from / : /var/mail to /home

first of all make your updates  
`apt-get update apt-get dist-upgrade`

stop dovecot  
`service dovecot stop`

copy the /var/mail directory with  
`rsync -ogpXEtlr --specials /var/mail /home`

edit a new config file maillocation.conf in /etc/dovecot/yunohost.d/post-ext.d/ with  
`mail_home = /home/mail/%n mail_location = maildir:/home/mail/%n plugin { sieve = /home/mail/sievescript/%n/.dovecot.sieve sieve_dir = /home/mail/sievescript/%n/scripts/ }`

restart dovecot  
`service dovecot start`

check if dovecot is running well with  
`service dovecot status`  
and by checking logs in /var/log/mail.err

check if your conf is overwrited with  
`doveconf -n`

when you are sure that every thing is working well you can delete the /var/mail directory

---

<div class="post-metadata">

**Author:** ![opi](https://forum.yunohost.org/user_avatar/forum.yunohost.org/opi/32/5_2.png) [@opi](https://forum.yunohost.org/u/opi)\
**Post date:** [February 3, 2017, 10:02pm UTC](https://forum.yunohost.org/t/howto-move-the-mail-directory-from-var-mail-to-home-mail/2422/2 "2017-02-03T22:02:16Z")

</div>

> [@Bachy](#):
>
> /etc/dovecot/yunohost.d/post-ext.d/

Note that this folder is only available from Yunohost 2.5.4 (See [[enh] Dovecot extensible configuration by julienmalik · Pull Request #175 · YunoHost/yunohost · GitHub](https://github.com/YunoHost/yunohost/pull/175))

---

<div class="post-metadata">

**Author:** ![Bachy](https://forum.yunohost.org/user_avatar/forum.yunohost.org/bachy/32/30_2.png) [@Bachy](https://forum.yunohost.org/u/Bachy)\
**Post date:** [February 3, 2017, 10:03pm UTC](https://forum.yunohost.org/t/howto-move-the-mail-directory-from-var-mail-to-home-mail/2422/3 "2017-02-03T22:03:44Z")

</div>

yes it was not there when i started to play with conf files, it poped-up after the upgrade

---

<div class="post-metadata">

**Author:** ![juju](https://forum.yunohost.org/user_avatar/forum.yunohost.org/juju/32/8_2.png) [@juju](https://forum.yunohost.org/u/juju)\
**Post date:** [February 4, 2017, 2:34pm UTC](https://forum.yunohost.org/t/howto-move-the-mail-directory-from-var-mail-to-home-mail/2422/4 "2017-02-04T14:34:47Z")

</div>

Hi Bachy !

Let me advise against what you are proposing here.

With this change, you are forced to hand-modify the dovecot configuration file. This means that later update of this configuration file by yunohost will not be installed, or that if you install them (using `yunohost service regenconf --force` option) you will lose access to your mails.

IMHO a better option would have been to simply make a symbolic link from `/home/mail` to `/var/mail`, or use a bind mount. This would leave the dovecot conf untouched, while storing your mails on your biggest partition.

---

<div class="post-metadata">

**Author:** ![Bachy](https://forum.yunohost.org/user_avatar/forum.yunohost.org/bachy/32/30_2.png) [@Bachy](https://forum.yunohost.org/u/Bachy)\
**Post date:** [February 4, 2017, 4:43pm UTC](https://forum.yunohost.org/t/howto-move-the-mail-directory-from-var-mail-to-home-mail/2422/5 "2017-02-04T16:43:22Z")

</div>

Hi juju,

i thought that the yunohost.d directory was here to provide the posibility of overwriting the dovecot conf without messing with updates …  
If not, what is the purpose of yunohost.d/ ?  
actually i started by editing the dovecot.conf file, and then when i upgraded, the dovecot conf upgrade messed, so i moved my changes in yunohost.d directory …  
Do you mean that `yunohsot service regenconf --force` will delete my yunohost.d/mailocation.conf file ?

---

<div class="post-metadata">

**Author:** ![Aleks](https://forum.yunohost.org/user_avatar/forum.yunohost.org/aleks/32/1704_2.png) [@Aleks](https://forum.yunohost.org/u/Aleks)\
**Post date:** [January 18, 2023, 8:12pm UTC](https://forum.yunohost.org/t/howto-move-the-mail-directory-from-var-mail-to-home-mail/2422/6 "2023-01-18T20:12:57Z")

</div>

Closed on January 18, 2023, 8:12pm UTC


