How To Move APT's Archive Directory to Another Partition

Write tutorials and howtos in here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Do not start a support topic here please. Before you post please read this

How To Move APT's Archive Directory to Another Partition

Postby garda on Sat Nov 22, 2008 12:31 pm

For whatever reason and/or purpose, you may want to move apt's package cache directory to a different location, probably in a different partition. Possible usage scenarios would be:

1. You have multiple computers running Mint which are not connected to the same network (e.g. one at work and one at home) and you want to make the packages you download on one computer available to the other without having to manually copy and paste the files. You can make, for example, your USB stick or hard drive serve as a mobile apt cache medium.

2. Your system (root) partition is getting cramped and you can not or do not want to go through the hassle of resizing partitions. You can free up quite a significant amount of disk space by moving the cached (downloaded) packages to another partition.

3. Anything else you can think of. :)

This method is very simple and does not require any additional programs be installed yet also quite fool-proof. Here is how you do it:

1. In Nautilus, navigate to the partition to which you would like to move the cached packages. Create a new folder (SHIFT+CTRL+N) and use only lower-case characters (no capitals) for the folder name.

Please note: In this example, I want to move the packages to the folder 'apt_cache' in a FAT32 partition titled 'backup'.

2. Still in Nautilus, navigate to File System > var > cache > apt > archives. Press CTRL+S on your keyboard and enter "*.deb" (without quotes) to select all the DEB package files. Press CTRL+C on your keyboard.

3. Navigate back to the folder you created in step no. 1 (apt_cache). Now press CTRL+V on your keyboard to paste the packages to that folder.

4. Stil in the same folder (apt_cache), create a sub-folder and name it "partial" (without quotes, all lowercase). Then create a new blank file (File > Create Document > Empty File) and name it "lock" (without quotes, all lowercase). Please note that the file "lock" should be placed in "apt_cache", not in "partial".

5. Go to File System > var > cache > apt. Right-click on an empty area, and select 'Open in Terminal'.

6. In the Terminal, enter the following commands:
Code: Select all
sudo mv archives archives.old

Code: Select all
sudo ln -s /media/backup/apt_cache/ archives

Change /media/backup/apt_cache/ in the second command to your need. And do not close the Terminal just yet.

Hint: To learn about what a command actually does, you can always type man commandname in a Terminal window. Typing man ln will get you to a manual page describing what the command ln does and how to use it.

7. Perform some tests to check if everything is working properly.

8. If you think everything is working well, then you may delete the files in the original archives folder (renamed to archives.old in step no. 6). To do this, enter the following command in the terminal:
Code: Select all
gksu xfe /var/cache/apt

9. An XFE window should appear. You have to manually delete all the *.deb files in the "archives.old" folder, leaving only the sub-folder "partial" and an empty file "lock".

10. Still in the same XFE window, hit CTRL+DEL on your keyboard to permanently wipe out all the files you deleted in step no. 9.

That's it. Easy, ain't it?
Last edited by garda on Mon Nov 24, 2008 1:47 am, edited 1 time in total.
User avatar
garda
Level 5
Level 5
 
Posts: 744
Joined: Sat Aug 30, 2008 2:55 am
Location: /root

Linux Mint is funded by ads and donations.
 

Re: How To Move APT's Archive Directory to Another Partition

Postby Husse on Sat Nov 22, 2008 6:04 pm

Two comments
Why a FAT32 partition - there is no need to share .deb files with Windows and it is a lousy file system
The xfe file browser is only present in Elyssa main - in other editions you have to use the file browser that's present (Nautilus, Konqueror, Thunar....)
Apart from that a nice little tutorial
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
Husse
Level 21
Level 21
 
Posts: 19703
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Re: How To Move APT's Archive Directory to Another Partition

Postby garda on Sat Nov 22, 2008 11:06 pm

Why a FAT32 partition - there is no need to share .deb files with Windows and it is a lousy file system

You've got it, there's no need to do so and it'd be much safer if one use another *NIX filesystem, be it ext3, XFS, RFS or whatever. But using any existing FAT32 partition adds up to simplicity that most typical user needs (seasoned Linux users must've considered this type of operation old hat). This becomes more relevant if one wants to use his/her USB stick or flash memory card to keep the cache and still have it readily available for use on Windows. Believe it or not, I do that sort of thing with an 8 GB microSD. :)
The xfe file browser is only present in Elyssa main - in other editions...

I see and thank you for making that bit clear. I haven't had the time (and disk space) to play around with other flavours of Mint, so I never knew that.

Thank you very much for that last line. :D
User avatar
garda
Level 5
Level 5
 
Posts: 744
Joined: Sat Aug 30, 2008 2:55 am
Location: /root

Re: How To Move APT's Archive Directory to Another Partition

Postby ajgreeny on Sun Nov 23, 2008 6:44 pm

Could you not do exactly the same thing using
Code: Select all
gksudo nautilus
or
Code: Select all
kdesu konqueror
depending on your DE, and then just drag the files/folders in the filemanager, holding down Ctrl to copy, not move them to the new partition? Or have I missed some simple thing and misunderstood what you are trying to do?
ajgreeny
Level 3
Level 3
 
Posts: 109
Joined: Mon Nov 19, 2007 3:27 pm

Re: How To Move APT's Archive Directory to Another Partition

Postby garda on Mon Nov 24, 2008 1:25 am

For the Nautilus versus XFE part:
I simply want people who follow this tutorial comply with Mint Main's suggested ways of doing things. One of them is use XFE to deal with files in super user mode. You may, of course, use Nautilus in super user mode if you want to. Mind you though, there are many experienced users in this forum who go against such practice. To be honest, I did all of the steps I put into this tutorial in the Terminal without ever touching any GUI (neither Nautilus nor XFE) at all.

As for the Konqueror part, you can also use it if you're on the KDE CE. But then, as I mentioned in a previous post:
I haven't had the time (and disk space) to play around with other flavours of Mint...


If you're already adequately familiar with Linux or you're of adventurous user type, you may improvize. Otherwise, I recommend sticking to the suggested ways.

Cheers.
User avatar
garda
Level 5
Level 5
 
Posts: 744
Joined: Sat Aug 30, 2008 2:55 am
Location: /root


Return to Tutorials / Howtos

Who is online

Users browsing this forum: No registered users and 6 guests