LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-22-2009, 09:52 AM   #1
jmaddy10
LQ Newbie
 
Registered: Nov 2009
Location: Virginia
Distribution: Ubuntu 8.04
Posts: 10

Rep: Reputation: 0
Need to clean harddrive but can't


Hello all,

I'm trying to clean my harddrive with the apt-get clean command but to no avail. What am I doing wrong? Do I have to be in a particular directory?

________________________
fernando@fernando-laptop:~$ apt-get clean
E: Could not open lock file /var/cache/apt/archives/lock - open (13 Permission denied)
E: Unable to lock the download directory
fernando@fernando-laptop:~$ sudo apt-get clean
[sudo] password for fernando:
fernando@fernando-laptop:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 2.3G 2.2G 0 100% /
tmpfs 1003M 0 1003M 0% /lib/init/rw
varrun 1003M 100K 1003M 1% /var/run
varlock 1003M 0 1003M 0% /var/lock
udev 1003M 164K 1003M 1% /dev
tmpfs 1003M 544K 1002M 1% /dev/shm
lrm 1003M 2.4M 1000M 1% /lib/modules/2.6.28-11-generic/volatile
overflow 1.0M 340K 684K 34% /tmp
/dev/sdb1 233G 41G 193G 18% /media/My Passport
___________________________

thanks for you help in advance!
 
Old 11-22-2009, 09:59 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
You need to look in your / directory to see if there are files you don't need.
Code:
apt-get clean
only cleans files in /var/cache/apt/archives/

You probably have some old kernels hanging around
 
Old 11-22-2009, 10:00 AM   #3
bartonski
Member
 
Registered: Jul 2006
Location: Louisville, KY
Distribution: Fedora 12, Slackware, Debian, Ubuntu Karmic, FreeBSD 7.1
Posts: 443
Blog Entries: 1

Rep: Reputation: 48
apt-get won't work with standard user permissions. Try this:
Code:
sudo apt-get clean
If you are in the sudoers table, you will be prompted for your password, then the command will work. If you aren't in the sudoers table, try
Code:
su -c apt-get clean
and enter the root password.
 
Old 11-22-2009, 10:02 AM   #4
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
@bartonski
from the original post
Quote:
fernando@fernando-laptop:~$ apt-get clean
E: Could not open lock file /var/cache/apt/archives/lock - open (13 Permission denied)
E: Unable to lock the download directory
fernando@fernando-laptop:~$ sudo apt-get clean
[sudo] password for fernando:
fernando@fernando-laptop:~$
 
Old 11-22-2009, 10:11 AM   #5
Web31337
Member
 
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
my debian lenny on router takes around 400M on total 1.8G HDD(it's OLD) and most of this space is also taken by utils i don't use but don't remove(who knows when they may become useful?).
look at /usr directory. see if you don't need some programs, uninstall them with apt. or do it manually(not recommended).
--
upd: i also use ncdu for cleaning purposes(it shows a disk usage). it's actual name is "ncurses disk usage". i like that util.

Last edited by Web31337; 11-22-2009 at 10:17 AM. Reason: ncdu
 
Old 11-22-2009, 10:57 AM   #6
jmaddy10
LQ Newbie
 
Registered: Nov 2009
Location: Virginia
Distribution: Ubuntu 8.04
Posts: 10

Original Poster
Rep: Reputation: 0
Repo - What files should I look to clean? I don't want to get rid of anything necessary.

Web3 - Same question. Is anything in /usr necessary? Or can I delete it all?
 
Old 11-22-2009, 11:06 AM   #7
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
You can look in /var/log for the backup logs created by logrotate
You can remove old kernels using synaptic
Don't delete files in /usr, unless you know what you are doing
As suggested by web31377 use ncdu to find large files and directories
 
Old 11-22-2009, 12:38 PM   #8
jmaddy10
LQ Newbie
 
Registered: Nov 2009
Location: Virginia
Distribution: Ubuntu 8.04
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by repo View Post
You can look in /var/log for the backup logs created by logrotate
When I try to remove some log files (sudo rm), the systems says that the files do not exist, despite the fact that they are displayed on my screen.

Quote:
Originally Posted by repo View Post
You can remove old kernels using synaptic
The system tells me that there is not enough space to create the .synaptic directory and therefore cannot run the program. I've deleted a few files but there still isn't enough space.

Quote:
Originally Posted by repo View Post
As suggested by web31377 use ncdu to find large files and directories
I ran the program but I haven't been able to delete anything. Open Office has had internal errors since I got Ubuntu so I deleted it (700+ MBs), and when I ran ncdu again, it was fully restored.

Once again, I really appreciate your help with this matter! It's nice to more help than frustration
 
Old 11-22-2009, 12:48 PM   #9
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Since you have no seperate /home partition, perhaps you can delete some stuff in your home directory,
or move them to /media/My Passport
In firefox you can delete the cache.
Take a look if your trashfolder is empty.
Do you use beagle or another software to search the drive?
They can create big files.

Quote:
When I try to remove some log files (sudo rm), the systems says that the files do not exist, despite the fact that they are displayed on my screen.
make sure to use the correct name, and if needed the correct path. You can copy/paste in the terminal
 
Old 11-22-2009, 03:51 PM   #10
bartonski
Member
 
Registered: Jul 2006
Location: Louisville, KY
Distribution: Fedora 12, Slackware, Debian, Ubuntu Karmic, FreeBSD 7.1
Posts: 443
Blog Entries: 1

Rep: Reputation: 48
Quote:
Originally Posted by repo View Post
@bartonski
from the original post
Note to self: read, then post.
 
  


Reply

Tags
apt-get, clean, free, harddrive, memory, space



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Clean out HD Mr.Carioca Linux - Software 3 02-10-2008 10:32 PM
Fedora Core 6 won't recognize second internal harddrive or usb harddrive Rockgod1969 Linux - Hardware 14 01-26-2007 01:03 AM
Installing linux on 2nd harddrive(dual boot) windows on seperate harddrive lysol Linux - Software 25 08-03-2004 09:33 AM
Need to replace full harddrive with new, larger harddrive pearlr Linux - Newbie 1 01-02-2004 12:59 PM
How can I do a clean-up? J_Szucs Linux - Newbie 3 04-30-2002 04:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration