Move AdGurard To USB Drive

Has anyone moved AdGurard to a USB drive then you could make full use of the logs and features without bloating out the router space.
It would be easy to copy the AdGurard folder to a USB drive EXT4 formatted, but the router would need to know where the AdGurard folder is but I’m not sure how many references would need to be changed any thought…

Maybe better to try moving to microSD card, so the USB port is not always tied up, in case you want to plug in other devices (e.g., USB sticks/SSDs, wifi/LTE dongles, smartphone tethering).

I suggest to try moving /etc/AdGuardHome directory to the external storage, then creating a symbolic link back to /etc. This would avoid having to update references. The hard link /usr/bin/AdGuardHome/ that needs to be fixed. I don’t know if fixing /rom/usr/bin/AdGuardHome is necessary.

The reason behind it was you can keep larger statistics etc as I only had 1% free the other day until I deleted all the logs in the AdGuard directory, I must admit your suggestion for the path is a much better and safer way thank you for that, I don’t think there an microSD card in the GL-AX1800 unless it’s hidden

You are right that the GL-AX1800 does not take a microSD card. I did not know which router you have. For other people who have a router with a microSD slot, they can try moving AdGuard to a microSD card.

I think /usr/bin/AdGuardHome may actually be a symbolic link, not a hard link, so it would be easy to delete it and create a new link to the external storage.

OK this is what things look like first the path of AdGuard

The link as you mentioned.

Finaly at last thanks to you the USB drive formatted In EXT4

Original Location
/etc/AdGuardHome

USB AGH FILES
/mnt/sda1/AdGuardHome

The AdGuardHome program itself takes up nearly all the storage (32MB) in the /etc/AdGuardHome directory, so it is better just to move that file to the USB drive, in case there are hidden complications.

I will assume that your USB drive is mounted on /mnt/sda1. I have not actually execute the following SSH procedure myself because I do not use AdGuard.

Step 1 - Create a AX1800 directory for AdGuard software and any future transfers in the USB drive

mkdir /mnt/sda1/AX1800
mkdir /mnt/sda1/AX1800/AdGuardHome

Step 2 - Transfer AdGuardHome program to USB drive

cd /etc/AdGuardHome
cp ./AdGuardHome /mnt/sda1/AX1800/AdGuardHome

Step 3 - Create symbolic link for the AdGuardHome program to the USB drive

mv ./AdGuardHome ./AdGuardHome.SAVE
ln -s /mnt/sda1/AX1800/AdGuardHome/AdGuardHome ./AdGuardHome

Step 4 - Test everything and, only if successful delete the original AdGuardHome program

cd /etc/AdGuardHome
rm ./AdGuardHome.SAVE

/usr/bin/AdGuardHome should still work as a symbolic link to a symbolic link. If not:

cd /usr/bin
mv ./AdGuardHome ./AdGuardHome.SAVE
ln -s /mnt/sda1/AX1800/AdGuardHome/AdGuardHome ./AdGuardHome

1 Like

That brilliant thank you i will let you know how i get on

Hi no got some problems step 1 Works Fine

Step 2
cp ./AdGuardHome /mnt/sda1/AX1800./AdGuardHome
above says no such file or directory
3 it renames AdGuardHome as seen, so i recopied it back for now see below.
image
AdGuardHome.SAVE

last part of 3
image

I had an extra “.” after AX1800 in the “cp” command in Step 2.

Instead of:

cp ./AdGuardHome /mnt/sda1/AX1800./AdGuardHome

it should be:

cp ./AdGuardHome /mnt/sda1/AX1800/AdGuardHome

I updated the above post.

You now have to delete the extra AdGuardHome file that you recopied back and reverse the AdGuardHome.SAVE file and repeat Step 2:

cd /etc/AdGuardHome
rm ./AdGuardHome.
mv ./AdGuardHome.SAVE ./AdGuardHome

Yes i understand that is to be deleted at the end if it works i realised that after, the line
ln -s /mnt/sda1/AX1800./AdGuardHome/AdGuardHome ./AdGuardHome
this keeps stating file exsists

You have to delete the AdGuardHome file now because that is causing the “Files exists”.

By renaming AdGuardHome.SAVE back to AdGuardHome, you are “rolling back” to be able to resume from Step 2 where the problem first occurred. This preserves the permissions on the file.

If you want to be extra safe, then copy AdGuardHome to your PC via WinSCP as a backup.

OK i will look at that the
cp ./AdGuardHome /mnt/sda1/AX1800/AdGuardHome
only copies AdGuardHome not all the other files in the directory is that correct

As I indicated in my earlier post, “it is better just to move that file to the USB drive, in case there are hidden complications”.

Also, the other files are small and accessed while AdGuard is running, so better to leave them on internal storage.

Ok one last thing and I will start again and remove the AdGuardHome i replaced
the line
ln -s /mnt/sda1/AX1800./AdGuardHome/AdGuardHome ./AdGuardHome
that is the path of the USB so why does that have a symbolic link, i thought that would go in the original directory or am i really not getting it, sorry for being dim

After Step 2, you are still in the /etc/AdGuardHome directory. Then

ln -s /mnt/sda1/AX1800/AdGuardHome/AdGuardHome ./AdGuardHome

     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^       ^^^^^^^^
      AdGuardHome file on USB drive              Symbolic link in
      copied over in Step 2                      /etc/AdGuardHome

I just noticed I have 2 more extra "."s after AX1800 that I updated in the post.

Hi brilliant total susses i wanted all the files on the USB so i copied the lot over and just left the symbolic link i used WinSCP to see what was happening i did run into not enough room on the router until i deleted all of AdGuard now i switched on the logs and extended the time now its all on the USB i went into LuCI to see the resources it showed only 18% free
image
This is what made me decide to do this yet i never run out of space on my GL-MV1000.
I really appreciate all your help and patience.

Memory” under LuCI → Status is RAM, not internal flash storage.

If you want to see internal storage, go to LuCI → System → Mount Points to see space on all the mount points, specifically /overlay, / and /mnt/sda1,.

You can also log into SSH and run the command to see:

df

hi it shows 52% free under
image

Actually, it is 48% free and 52% used.
Previously, it was 22% free and 78% used (from the other thread).

You freed up a lot!

Yes sorry for the mistake, the room might explain why AdGuardHome struggles to update it normally fails and i have to reset to defaults and then it updates.
Thanks again