0

I have LAMP installed on my Raspbian, and I'm worried that logs and database can damage my SDcard too quickly. I have also external hard drives connected with USB and formatted with ext4. I don't want to modify/resize partitions on my hdd, but want to migrate /var/ and maybe /home/ to that external hard drive.

I would prefer to use fstab for this, but I'm not sure what exactly statement should I use. Another option would be to create symbolic link of old location to new location, but in that case if I remove external drive, original /var/ will be completely not accessible there will be only broken symbolic link. While in first solution if mounting will fail, content of original /var/ (from SD card) will be accessible.

Could anyone help me with this, please? Thanks :

4
  • Why don't you change the default path of LAMP packages? Commented Mar 8, 2020 at 23:34
  • Because easier and better is to move /var ?
    – A J
    Commented Mar 9, 2020 at 0:53
  • Idon't care about how it can be easier. How it would be better to move to /var? Commented Mar 9, 2020 at 1:51
  • 1
    /var is directory with biggest I/O in the whole directory tree - not only log files, but databases are stored there, emails etc. SD Card is not good for that purpose. If someone prefer speed over durability than anyway best choice is to use SSD as SSDs are faster and also more durable than SD cards. I don't know if this is the reason, or maybe it is also case of security, but hosting companies are often doing exactly that: mounting not /home, but /var on separate partitions. I assume it may be better for backup, and restoring OS without touching /var
    – A J
    Commented Mar 9, 2020 at 3:56

1 Answer 1

0

I sorted this out with fstab. After lines mounting partitions added:

/mnt/hddpartition/var                     /var            none    bind
1
  • Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year.
    – Ingo
    Commented Mar 12, 2020 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.