Moving the Google Chrome cache directory onto RAM disk automatically at boot in Linux
up vote
0
down vote
favorite
OS: Linux Mint 19 Cinnamon 64-bit.
I know how to create a RAM disk (tmpfs
), actually I have it mounted in /etc/fstab
like so:
none /ramdisk tmpfs size=2G,mode=0777 0 0
As you can see, it has 2 GiB, and is accessible to all users on my personal computer it does not matter anyways.
I know about --disk-cache-dir
Google Chrome option. But I don't want to use it.
Reason being, I want to be able to run Chrome in whichever way I like, having the same RAM cache directory. There are simply too many ways I run my Chrome. What if I replaced an icon for instance? It is unusable for me at least.
I seek guidance on creating a shell script, which would create a symlink to Chrome cache directory onto my RAM disk, which is mounted as seen above.
That script I intend to put into root
's cron
using sudo crontab -e
as follows:
@reboot /home/vlastimil/Development/sh/google-chrome-cache-ramdisk
Note, that I don't have a swap enabled on my system.
linux google-chrome cache browser-cache ramdisk
add a comment |
up vote
0
down vote
favorite
OS: Linux Mint 19 Cinnamon 64-bit.
I know how to create a RAM disk (tmpfs
), actually I have it mounted in /etc/fstab
like so:
none /ramdisk tmpfs size=2G,mode=0777 0 0
As you can see, it has 2 GiB, and is accessible to all users on my personal computer it does not matter anyways.
I know about --disk-cache-dir
Google Chrome option. But I don't want to use it.
Reason being, I want to be able to run Chrome in whichever way I like, having the same RAM cache directory. There are simply too many ways I run my Chrome. What if I replaced an icon for instance? It is unusable for me at least.
I seek guidance on creating a shell script, which would create a symlink to Chrome cache directory onto my RAM disk, which is mounted as seen above.
That script I intend to put into root
's cron
using sudo crontab -e
as follows:
@reboot /home/vlastimil/Development/sh/google-chrome-cache-ramdisk
Note, that I don't have a swap enabled on my system.
linux google-chrome cache browser-cache ramdisk
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
OS: Linux Mint 19 Cinnamon 64-bit.
I know how to create a RAM disk (tmpfs
), actually I have it mounted in /etc/fstab
like so:
none /ramdisk tmpfs size=2G,mode=0777 0 0
As you can see, it has 2 GiB, and is accessible to all users on my personal computer it does not matter anyways.
I know about --disk-cache-dir
Google Chrome option. But I don't want to use it.
Reason being, I want to be able to run Chrome in whichever way I like, having the same RAM cache directory. There are simply too many ways I run my Chrome. What if I replaced an icon for instance? It is unusable for me at least.
I seek guidance on creating a shell script, which would create a symlink to Chrome cache directory onto my RAM disk, which is mounted as seen above.
That script I intend to put into root
's cron
using sudo crontab -e
as follows:
@reboot /home/vlastimil/Development/sh/google-chrome-cache-ramdisk
Note, that I don't have a swap enabled on my system.
linux google-chrome cache browser-cache ramdisk
OS: Linux Mint 19 Cinnamon 64-bit.
I know how to create a RAM disk (tmpfs
), actually I have it mounted in /etc/fstab
like so:
none /ramdisk tmpfs size=2G,mode=0777 0 0
As you can see, it has 2 GiB, and is accessible to all users on my personal computer it does not matter anyways.
I know about --disk-cache-dir
Google Chrome option. But I don't want to use it.
Reason being, I want to be able to run Chrome in whichever way I like, having the same RAM cache directory. There are simply too many ways I run my Chrome. What if I replaced an icon for instance? It is unusable for me at least.
I seek guidance on creating a shell script, which would create a symlink to Chrome cache directory onto my RAM disk, which is mounted as seen above.
That script I intend to put into root
's cron
using sudo crontab -e
as follows:
@reboot /home/vlastimil/Development/sh/google-chrome-cache-ramdisk
Note, that I don't have a swap enabled on my system.
linux google-chrome cache browser-cache ramdisk
linux google-chrome cache browser-cache ramdisk
edited Nov 20 at 13:13
asked Sep 28 at 10:43
Vlastimil
1,09311333
1,09311333
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
Supposing you have your RAM disk (tmpfs
) mounted at boot time in /etc/fstab
, you can do it as follows:
First, make sure your script will exit on errors, this is important, don't skip this step.
I recommend you start with constants definitions for an easy maintenance.
I believe, but am unsure - feel free to correct me - you need to use absolute paths of commands since you intend to run the script from
crontab
.Actually, it appears, the
which
command below works without any problems, this command I used in this answer to ensure, that on each Linux wherever the binaries are, they are found.Create the directory structure on RAM disk for the Google Chrome cache.
It will only work if you have access, so make yourself an owner of the whole RAM disk.
Since we can't know what might happen, it would be a good idea to remove possibly existing cache directory (symlink or real).
Finally, let's create a symlink for the cache directory onto your RAM disk.
Note, that the solution below will create both:
Normal
Cache
directory.In addition to the original solution, also the
Media Cache
directory, which will Chrome create upon loading some media.
The final script could look like this (should be portable):
#!/bin/sh
########################################################
## Google Chrome ##
## Cache on RAM disk ##
########################################################
set -o nounset
set -o errexit
# constants definitions for easy edits
username="vlastimil"
ramdisk_path="/ramdisk"
cache_path_ramdisk="${ramdisk_path}/google-chrome/Default"
cache_path_userdir="/home/${username}/.cache/google-chrome/Default"
# create directory structure on RAM disk
$(which mkdir) -p "${cache_path_ramdisk}"
# change ownership of RAM disk to my user
$(which chown) -R "${username}":"${username}" "${ramdisk_path}"
# remove possibly existing cache directory (symlink or real)
$(which rm) -r -f "${cache_path_userdir}"
# create symlink for cache directory onto RAM disk
$(which ln) -s "${cache_path_ramdisk}" "${cache_path_userdir}"
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
Supposing you have your RAM disk (tmpfs
) mounted at boot time in /etc/fstab
, you can do it as follows:
First, make sure your script will exit on errors, this is important, don't skip this step.
I recommend you start with constants definitions for an easy maintenance.
I believe, but am unsure - feel free to correct me - you need to use absolute paths of commands since you intend to run the script from
crontab
.Actually, it appears, the
which
command below works without any problems, this command I used in this answer to ensure, that on each Linux wherever the binaries are, they are found.Create the directory structure on RAM disk for the Google Chrome cache.
It will only work if you have access, so make yourself an owner of the whole RAM disk.
Since we can't know what might happen, it would be a good idea to remove possibly existing cache directory (symlink or real).
Finally, let's create a symlink for the cache directory onto your RAM disk.
Note, that the solution below will create both:
Normal
Cache
directory.In addition to the original solution, also the
Media Cache
directory, which will Chrome create upon loading some media.
The final script could look like this (should be portable):
#!/bin/sh
########################################################
## Google Chrome ##
## Cache on RAM disk ##
########################################################
set -o nounset
set -o errexit
# constants definitions for easy edits
username="vlastimil"
ramdisk_path="/ramdisk"
cache_path_ramdisk="${ramdisk_path}/google-chrome/Default"
cache_path_userdir="/home/${username}/.cache/google-chrome/Default"
# create directory structure on RAM disk
$(which mkdir) -p "${cache_path_ramdisk}"
# change ownership of RAM disk to my user
$(which chown) -R "${username}":"${username}" "${ramdisk_path}"
# remove possibly existing cache directory (symlink or real)
$(which rm) -r -f "${cache_path_userdir}"
# create symlink for cache directory onto RAM disk
$(which ln) -s "${cache_path_ramdisk}" "${cache_path_userdir}"
add a comment |
up vote
0
down vote
accepted
Supposing you have your RAM disk (tmpfs
) mounted at boot time in /etc/fstab
, you can do it as follows:
First, make sure your script will exit on errors, this is important, don't skip this step.
I recommend you start with constants definitions for an easy maintenance.
I believe, but am unsure - feel free to correct me - you need to use absolute paths of commands since you intend to run the script from
crontab
.Actually, it appears, the
which
command below works without any problems, this command I used in this answer to ensure, that on each Linux wherever the binaries are, they are found.Create the directory structure on RAM disk for the Google Chrome cache.
It will only work if you have access, so make yourself an owner of the whole RAM disk.
Since we can't know what might happen, it would be a good idea to remove possibly existing cache directory (symlink or real).
Finally, let's create a symlink for the cache directory onto your RAM disk.
Note, that the solution below will create both:
Normal
Cache
directory.In addition to the original solution, also the
Media Cache
directory, which will Chrome create upon loading some media.
The final script could look like this (should be portable):
#!/bin/sh
########################################################
## Google Chrome ##
## Cache on RAM disk ##
########################################################
set -o nounset
set -o errexit
# constants definitions for easy edits
username="vlastimil"
ramdisk_path="/ramdisk"
cache_path_ramdisk="${ramdisk_path}/google-chrome/Default"
cache_path_userdir="/home/${username}/.cache/google-chrome/Default"
# create directory structure on RAM disk
$(which mkdir) -p "${cache_path_ramdisk}"
# change ownership of RAM disk to my user
$(which chown) -R "${username}":"${username}" "${ramdisk_path}"
# remove possibly existing cache directory (symlink or real)
$(which rm) -r -f "${cache_path_userdir}"
# create symlink for cache directory onto RAM disk
$(which ln) -s "${cache_path_ramdisk}" "${cache_path_userdir}"
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
Supposing you have your RAM disk (tmpfs
) mounted at boot time in /etc/fstab
, you can do it as follows:
First, make sure your script will exit on errors, this is important, don't skip this step.
I recommend you start with constants definitions for an easy maintenance.
I believe, but am unsure - feel free to correct me - you need to use absolute paths of commands since you intend to run the script from
crontab
.Actually, it appears, the
which
command below works without any problems, this command I used in this answer to ensure, that on each Linux wherever the binaries are, they are found.Create the directory structure on RAM disk for the Google Chrome cache.
It will only work if you have access, so make yourself an owner of the whole RAM disk.
Since we can't know what might happen, it would be a good idea to remove possibly existing cache directory (symlink or real).
Finally, let's create a symlink for the cache directory onto your RAM disk.
Note, that the solution below will create both:
Normal
Cache
directory.In addition to the original solution, also the
Media Cache
directory, which will Chrome create upon loading some media.
The final script could look like this (should be portable):
#!/bin/sh
########################################################
## Google Chrome ##
## Cache on RAM disk ##
########################################################
set -o nounset
set -o errexit
# constants definitions for easy edits
username="vlastimil"
ramdisk_path="/ramdisk"
cache_path_ramdisk="${ramdisk_path}/google-chrome/Default"
cache_path_userdir="/home/${username}/.cache/google-chrome/Default"
# create directory structure on RAM disk
$(which mkdir) -p "${cache_path_ramdisk}"
# change ownership of RAM disk to my user
$(which chown) -R "${username}":"${username}" "${ramdisk_path}"
# remove possibly existing cache directory (symlink or real)
$(which rm) -r -f "${cache_path_userdir}"
# create symlink for cache directory onto RAM disk
$(which ln) -s "${cache_path_ramdisk}" "${cache_path_userdir}"
Supposing you have your RAM disk (tmpfs
) mounted at boot time in /etc/fstab
, you can do it as follows:
First, make sure your script will exit on errors, this is important, don't skip this step.
I recommend you start with constants definitions for an easy maintenance.
I believe, but am unsure - feel free to correct me - you need to use absolute paths of commands since you intend to run the script from
crontab
.Actually, it appears, the
which
command below works without any problems, this command I used in this answer to ensure, that on each Linux wherever the binaries are, they are found.Create the directory structure on RAM disk for the Google Chrome cache.
It will only work if you have access, so make yourself an owner of the whole RAM disk.
Since we can't know what might happen, it would be a good idea to remove possibly existing cache directory (symlink or real).
Finally, let's create a symlink for the cache directory onto your RAM disk.
Note, that the solution below will create both:
Normal
Cache
directory.In addition to the original solution, also the
Media Cache
directory, which will Chrome create upon loading some media.
The final script could look like this (should be portable):
#!/bin/sh
########################################################
## Google Chrome ##
## Cache on RAM disk ##
########################################################
set -o nounset
set -o errexit
# constants definitions for easy edits
username="vlastimil"
ramdisk_path="/ramdisk"
cache_path_ramdisk="${ramdisk_path}/google-chrome/Default"
cache_path_userdir="/home/${username}/.cache/google-chrome/Default"
# create directory structure on RAM disk
$(which mkdir) -p "${cache_path_ramdisk}"
# change ownership of RAM disk to my user
$(which chown) -R "${username}":"${username}" "${ramdisk_path}"
# remove possibly existing cache directory (symlink or real)
$(which rm) -r -f "${cache_path_userdir}"
# create symlink for cache directory onto RAM disk
$(which ln) -s "${cache_path_ramdisk}" "${cache_path_userdir}"
edited Oct 20 at 5:20
answered Sep 28 at 10:43
Vlastimil
1,09311333
1,09311333
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1362184%2fmoving-the-google-chrome-cache-directory-onto-ram-disk-automatically-at-boot-in%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown