Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] conditional mounting
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
printf
Tux's lil' helper
Tux's lil' helper


Joined: 02 Dec 2010
Posts: 93

PostPosted: Tue Sep 10, 2013 8:10 am    Post subject: [Solved] conditional mounting Reply with quote

i have a notebook with an ssd used for / and /home
it came with a docking station that has an ultrabay, where i put a normal hdd.

i would like to use a partition of the docking station's hdd as /var/tmp/portage (so it wont hurt the ssd)
but i want to disable /var/tmp/portage altogether when the notebook is not docked (optionally i could mount it as tmpfs if i absolutely need to install something on-the-go)

is this possible?
i know that then i will have to set up different scripts when it is removed from the docking station, but first i would like it to see that it has the hard drive with the correct uuid and mount it or disable /var/tmp/portage or redirect it somewhere so nothing gets written to the ssd


Last edited by printf on Wed Oct 16, 2013 12:32 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Tue Sep 10, 2013 9:11 am    Post subject: Reply with quote

printf,

In /etc/fstab, use the noauto option for the line that is used for the /var/tmp/portage entry.

When the hdd partition is mounted there, you will use the hdd. When its not, /var/tmp/portage will be in /
You will need to mount /var/trmp portage by hand when you want to use the hdd.
Alternatively, ignore the error message when the hdd is not present.

If you have 4G RAM or more, then /var/tmp/portage can be in RAM for all but the biggest packages.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
printf
Tux's lil' helper
Tux's lil' helper


Joined: 02 Dec 2010
Posts: 93

PostPosted: Tue Sep 10, 2013 11:07 am    Post subject: Reply with quote

NeddySeagoon wrote:
...
When its not, /var/tmp/portage will be in /
...

that is what i would like to avoid, if the hdd is not presend somehow disable access to /var/tmp/portage to avoid any accidental write to the ssd

NeddySeagoon wrote:
If you have 4G RAM or more, then /var/tmp/portage can be in RAM for all but the biggest packages.

i have 4 gb ram, but i just dont need portage in memory all the time when i only do an update once in every 2 weeks/1 month
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13830

PostPosted: Tue Sep 10, 2013 10:15 pm    Post subject: Reply with quote

You could mount a very tiny tmpfs on /var/tmp/portage, then overmount it with the HDD when available. Any attempt to access it when the HDD is unmounted would immediately encounter a "No space left on device" error.
Back to top
View user's profile Send private message
printf
Tux's lil' helper
Tux's lil' helper


Joined: 02 Dec 2010
Posts: 93

PostPosted: Wed Sep 11, 2013 6:44 am    Post subject: Reply with quote

the tiny tmpfs seems as a good idea, but according to this thread: http://unix.stackexchange.com/questions/9332/how-can-i-create-a-dev-null-like-blackhole-directory
i could mount a nullfs there (https://github.com/xrgtn/nullfs), but i cant seem to find it in portage
Back to top
View user's profile Send private message
Akkara
Administrator
Administrator


Joined: 28 Mar 2006
Posts: 6691
Location: &akkara

PostPosted: Wed Sep 11, 2013 7:45 am    Post subject: Reply with quote

You can also mount something on it, but read-only. No writes will happen.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum