Root drive is running out of disk space. How can I free up space?Amazon EC2 - xvda1 is 100% full?Problems with Ubuntu mount /tmpapache2.service: Failed to run 'start' task: No space left on deviceSorry, Ubuntu 16.04 has experienced an internal error cannot fixed it with already mentioned methodshow & where do I initiate commands to free up disk space? (I don'tunderstand computers)Where is ubuntu installed? Lack of space errorHard Drive Full With Files From Removed App,, How Do I Delete Space So I Can Boot?Cannot install anything via terminal after accidentally delete Lightdm because of login loopHow to free the space in /dev/sda9boot stops at - /dev/sda1 clean 18.04free space on ubuntu mount drive disappearedRunning out of disk spaceWhat to do if /dev/md1 is full?/root is running out of spacelubuntu - Help with partition, root, space, kfmclientUbuntu 18.04 LTS (dual booted with Windows 10) is stuck at “Started Hold until boot process finishes up”How to prevent running out of disk space?
Set of rapidly increasing functions are uncountable?
Why are there so many subway station signs between Yau Ma Tei station and Mong Kok station on Google Maps?
How does AT-AT deploy troops?
Why do microwaves use magnetron?
How can Edward Snowden be denied a jury trial?
For a command to increase something, should instructions refer to the "+" key or the "=" key?
Can tankless & conventional water heaters join forces?
How much caffeine would there be if I reuse tea leaves in a second brewing?
Can I take the high-speed bullet train Beijing–Hong Kong under Chinese 144 h visa-free transit rules?
Can one determine the trace map for a nonsingular projective variety explicitly?
How can an immortal member of the nobility be prevented from taking the throne?
Should I do a regression analysis even if the variables do not seem to be associated at all?
What is the difference between an adjective and a noun modifier?
Alias to open a graphical Program (nautilus) opens it in Terminal too
Light turning on and off
Why is Iceland Air's Saga Premium product classified as Business class?
How to formulate a MIP that can minimize the costs with a combination of subsets given a set?
Create a program that prints the amount of characters it has, in words
Modeling the Choose function
Is CR12 too difficult for two level 4 characters?
Can a planet's magnetic field be generated by non-ferromagnetic metals?
A partially ugly group with a casual secret
What's the most profitable use for an elemental transmuter?
How to access closed over variables given only the closure function?
Root drive is running out of disk space. How can I free up space?
Amazon EC2 - xvda1 is 100% full?Problems with Ubuntu mount /tmpapache2.service: Failed to run 'start' task: No space left on deviceSorry, Ubuntu 16.04 has experienced an internal error cannot fixed it with already mentioned methodshow & where do I initiate commands to free up disk space? (I don'tunderstand computers)Where is ubuntu installed? Lack of space errorHard Drive Full With Files From Removed App,, How Do I Delete Space So I Can Boot?Cannot install anything via terminal after accidentally delete Lightdm because of login loopHow to free the space in /dev/sda9boot stops at - /dev/sda1 clean 18.04free space on ubuntu mount drive disappearedRunning out of disk spaceWhat to do if /dev/md1 is full?/root is running out of spacelubuntu - Help with partition, root, space, kfmclientUbuntu 18.04 LTS (dual booted with Windows 10) is stuck at “Started Hold until boot process finishes up”How to prevent running out of disk space?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
I'm using Ubuntu 11.04 and I want to free up some space in my root directory, which is overloaded. I especially want to change the path used for installing applications (they are getting installed directly to the root drive).
Another consideration is that I'm working on a MySQL database server. The server is installed in the root directory itself, so I don't want to risk losing any data.
Please give me some tips to help sort out this problem.
disk-usage
add a comment
|
I'm using Ubuntu 11.04 and I want to free up some space in my root directory, which is overloaded. I especially want to change the path used for installing applications (they are getting installed directly to the root drive).
Another consideration is that I'm working on a MySQL database server. The server is installed in the root directory itself, so I don't want to risk losing any data.
Please give me some tips to help sort out this problem.
disk-usage
add a comment
|
I'm using Ubuntu 11.04 and I want to free up some space in my root directory, which is overloaded. I especially want to change the path used for installing applications (they are getting installed directly to the root drive).
Another consideration is that I'm working on a MySQL database server. The server is installed in the root directory itself, so I don't want to risk losing any data.
Please give me some tips to help sort out this problem.
disk-usage
I'm using Ubuntu 11.04 and I want to free up some space in my root directory, which is overloaded. I especially want to change the path used for installing applications (they are getting installed directly to the root drive).
Another consideration is that I'm working on a MySQL database server. The server is installed in the root directory itself, so I don't want to risk losing any data.
Please give me some tips to help sort out this problem.
disk-usage
disk-usage
edited Aug 19 '12 at 14:54
Jorge Castro
38.8k110 gold badges430 silver badges624 bronze badges
38.8k110 gold badges430 silver badges624 bronze badges
asked Aug 20 '11 at 18:33
rihanrihan
1661 gold badge2 silver badges5 bronze badges
1661 gold badge2 silver badges5 bronze badges
add a comment
|
add a comment
|
13 Answers
13
active
oldest
votes
Recently I faced similar situation. Too many applications got installed and they started using my root mount space. I am listing out few steps which I followed and hoping that you could also use the same.
Clean apt-get cache. Following command will remove all downloaded deb files from apt-get cache directory.
Run this command:
sudo apt-get clean
Move /home mount point to different drive. Previously, my home folder was situated on root drive. So I moved my home folder to separate drive. This helped me to release lot of stress from root mount because most of applications store their data in /home/user_name/ folder. Read how to move home folder to separate drive.
Increase size of root partition I know it is very obvious answer. But believe me, our data need changes over the time. I thought 20 GB /root mount would suffice but withing a year I have re-sized my root mount and increased to 50 GB.
8
sudo apt-get clean freed up more space than expected, +1
– btk
Mar 1 '14 at 2:46
Beware thatapt-get clean
removes even installed packages. You may want to keep those in case an upgrade fails.
– timss
Jul 12 '15 at 13:56
I cleaned my cache and it cleared up 10 Gb! +1
– Numeri
Feb 9 '16 at 16:55
add a comment
|
I successfully cleared 3.5 GB by removing old headers and images, using the following command:
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/(.*)-([^0-9]+)/1/")"'/d;s/^[^ ]* [^ ]* ([^ ]*).*/1/;/[0-9]/!d' | xargs sudo apt-get -y purge
You can check what packages will be purged executing the first part of the command:
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/(.*)-([^0-9]+)/1/")"'/d;s/^[^ ]* [^ ]* ([^ ]*).*/1/;/[0-9]/!d'
Reference
Other tips didn't help, but this saved me around 5G. Thanks.
– baltasvejas
Apr 14 '15 at 8:07
The option-y
in the apt-get command is not really necessary. If you omit it apt-get will ask you (only once), if all piped packages should be removed. Imho it's better to not use-y
, it gives you one more possibility to check (besides the second command mentioned above). For me this freed 15GB on the root partition!
– Boris Däppen
Jan 7 '17 at 13:03
1
The commanddpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/(.*)-([^0-9]+)/1/")"'/d;s/^[^ ]* [^ ]* ([^ ]*).*/1/;/[0-9]/!d' | xargs sudo apt-get -y purge
tried to remove the currently installed kernel version in my system. Be careful not to make your system unbootable.
– Antony
Aug 9 '18 at 12:50
@Antony yaikes! i was about to try this. how can i verify which are ok to delete ?
– Sonic Soul
Aug 28 '18 at 15:12
1
@SonicSoul I eventually ended up doing what one of the answers below (askubuntu.com/a/778442/333806) suggests. Basically, ranuname -r
to find the current kernel and took care not to remove it. If the command provided byhomebrand
to check which packages will be purged does not show the current kernel, then you should be safe running the purge command mentioned by him.
– Antony
Aug 29 '18 at 13:25
add a comment
|
Use dpkg-query
to find the largest packages and remove the ones you don't need anymore (source):
dpkg-query --show --showformat='$Package;-50t$Installed-Sizen' | sort -k 2 -n | grep -v deinstall | awk 'printf "%.3f MB t %sn", $2/(1024), $1'
1
Now this is a really useful one-liner. Perfect for a quick summary of the biggest install packages. Come to my dotfiles!
– arainone
Jul 1 '16 at 18:27
You can get this withwajig sizes
– Pablo A
Oct 14 at 3:12
add a comment
|
sudo apt autoclean # clean /var/cache/apt/archives folder which save packages while install.
sudo apt autoremove # this command remove unused packages.
sudo shutdown -rf # it will restart your PC immediately and check filesystem in next boot.
18
You provide no explanations. If someone was to just copy/paste your code, then the system would shut down with no warning, possibly causing a loss of data. Please don't provide commands without any explanation of what they do. -1
– Jo-Erlend Schinstad
Aug 20 '11 at 19:14
9
Why the need to check the filesystem?
– Nathan Osman
Aug 20 '11 at 21:46
add a comment
|
Removing old kernel versions (as suggested already by homebrand) can free up a decent amount of space if you haven't yet got around to doing that.
There's a number of ways to remove the old kernel versions and a range of different options can be found in the answers posted to: How do I remove old kernel versions to clean up the boot menu?
My preferred method is mostly this answer from penreturns where it's broken down into fairly simple understandable steps:
Open terminal and check your current kernel:
uname -r
DO NOT REMOVE THIS KERNEL!
Next, type the command below to view/list all installed kernels on your system.
dpkg --list | grep linux-image
Find all the kernels that are lower than your current kernel.
When you know which kernel to remove, continue below to remove it.
Run the command below to remove the kernel you selected.
sudo apt-get purge linux-image-x.x.x.x-generic
The answer then says to 'update-grub2' when you're finished purging, which is likely to be out of date now: sudo update-grub
should suffice for Ubuntu 14.04 onward. They also then say to 'Reboot your system' (which seems to be so that you can see the cleaned up boot menu) so in this case isn't necessary.
The grub bootloader menu used to show all the older kernel versions on the main page, but they are now placed out of the way behind a sub-menu. It's much neater but a newcomer to Ubuntu/Linux may not be aware that they are there taking up space.
As suggested, don't remove the current kernel and it's also advisable to keep the previous kernel version too, just in case you need to roll back to that one.
There are faster ways to do this, but I prefer the simplicity of this method mainly because I can understand each command along the way:
"What kernel version am I using? What kernel versions do I have? Okay, purge that one."
Rinse, repeat, admire the space you've freed up.
It's fairly easy to copy the name of the specific older kernel you want to remove from the results that dpkg --list | grep linux-image
gives you in the terminal, and then use sudo apt-get purge
and paste the copied name in.
Removing 3 or 4 older kernels will usually free up about a GB of space in your root drive.
1
In addition to linux-image, you can also also grep for and purge linux-headers
– kdopen
Nov 3 '17 at 13:34
add a comment
|
Following the instructions on the Ubuntu community docs I discovered a massive trash file -- it looked like a backup of /var/log/syslog.1, presumably something was spewing loads of output to syslog...
The command that found it was:
sudo find / -size +1G
And then any large file in a folder called .Trash
is probably good to delete...
add a comment
|
When I need make more free space on servers I use this command:
find / -type f -size +50M -exec du -h ; | sort -n
It finds all files bigger than 50 MB and "du -h
" make a better list of files and "sort -n
" after pipe make list numerically sorted by file size.
add a comment
|
Here is a script I run to free space on root partition
function myclean sed '/^ii/!d;/'"$(uname -r
Edit : New 2 lines old kernels cleaner
– cmak.fr
Aug 30 at 15:54
Thanks! "Rotate and delete old logs" clear up several gigs on my drive.
– SaTa
Sep 30 at 2:21
Nice. Developers may also want to remove their unused docker images:docker system prune
– Pablo A
Oct 14 at 4:08
@Pablo A they may look to/var/crash/*.crash
too
– cmak.fr
Oct 14 at 6:25
add a comment
|
In Ubuntu, each folder can have its own filesystem. That means you can move any folder onto its own partition, another disk or even on a remote network. This is particularly popular for home directories, since that means you can reinstall Ubuntu without changing your personal settings or loosing any files. It's also popular in networks where users should be able to log onto different machines and still get their personal settings and files. But it is useful in many different cases, such as yours.
Applications aren't installed into a specific folder, like you seem to suggest. Different parts of the application is placed in different parts of the filesystem. The main program is usually placed in /usr/bin, whereas configuration files are placed in /etc, for instance. In your case, MySQL, the databases themselves are placed somewhere in /var. I think /var/mysql.
Since /usr and /var are both directories in the root filesystem, they will use the root filesystems space. But as I said, you can move them to different filesystems. In the case of MySQL, you can configure where databases are stored. You could easily move databases to /home/username/.mysql/databases for instance.
add a comment
|
You cannot change the path where the package manager install applications. Most application files are saved to /usr
. If you want to recover space on the root partition, moving /usr
to a different partition is a possible solution.
From comments:
Preserve the permissions when copying, i.e. better use the command line if you are unsure what your file manager will do.
The right way to this, is to mount a new filesystem to /usr or use
mount --bind
. It's not clear how well a symlink would work.
careful about move /usr. use cp command to copy usr folder with same permission. then delete original /usr folder and create a link of usr folder on / .
– shantanu
Aug 20 '11 at 19:04
1
It should have a mount point. Not a link.
– Jo-Erlend Schinstad
Aug 20 '11 at 19:12
Small note: a lot of applications also install binaries and application data into/opt
.
– Nathan Osman
Aug 20 '11 at 21:45
@george-edison Well, some applications install stuff in/opt
against "the rules".
– Jan
Aug 20 '11 at 21:57
add a comment
|
If you have a lot of seperate filesystems, the following trick might prove handy: Mount / another time, but this time under /mnt. Now all of your searching for large or many files can be done, without traversing wrong fileystems.
It can also help you find the files that are hidden under another mount.
add a comment
|
As of today it's better to use the new feature (since 14.04) to remove older kernel images:
sudo apt autoremove
Check out more details: Why doesn't Ubuntu remove old kernels automatically?
add a comment
|
If you have mssql database server installed, that can eat up your memory. Run NCurses Disk Usage
$ sudo ncdu /
To check what folders and files are taking max storage. The mssql data are usually stored on
/var/opt/mssql/backup/
The Question states that the Database needs to remain.
– Stephen Rauch
Jun 30 '18 at 17:28
The question mentioned MySql Database so if he is to remove the MsSQL database data then i guess that seems a pretty fair answer.
– Yogesh
Jul 2 '18 at 3:48
Might be useful the-x
option
– Pablo A
Oct 14 at 3:52
add a comment
|
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
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%2faskubuntu.com%2fquestions%2f57994%2froot-drive-is-running-out-of-disk-space-how-can-i-free-up-space%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
13 Answers
13
active
oldest
votes
13 Answers
13
active
oldest
votes
active
oldest
votes
active
oldest
votes
Recently I faced similar situation. Too many applications got installed and they started using my root mount space. I am listing out few steps which I followed and hoping that you could also use the same.
Clean apt-get cache. Following command will remove all downloaded deb files from apt-get cache directory.
Run this command:
sudo apt-get clean
Move /home mount point to different drive. Previously, my home folder was situated on root drive. So I moved my home folder to separate drive. This helped me to release lot of stress from root mount because most of applications store their data in /home/user_name/ folder. Read how to move home folder to separate drive.
Increase size of root partition I know it is very obvious answer. But believe me, our data need changes over the time. I thought 20 GB /root mount would suffice but withing a year I have re-sized my root mount and increased to 50 GB.
8
sudo apt-get clean freed up more space than expected, +1
– btk
Mar 1 '14 at 2:46
Beware thatapt-get clean
removes even installed packages. You may want to keep those in case an upgrade fails.
– timss
Jul 12 '15 at 13:56
I cleaned my cache and it cleared up 10 Gb! +1
– Numeri
Feb 9 '16 at 16:55
add a comment
|
Recently I faced similar situation. Too many applications got installed and they started using my root mount space. I am listing out few steps which I followed and hoping that you could also use the same.
Clean apt-get cache. Following command will remove all downloaded deb files from apt-get cache directory.
Run this command:
sudo apt-get clean
Move /home mount point to different drive. Previously, my home folder was situated on root drive. So I moved my home folder to separate drive. This helped me to release lot of stress from root mount because most of applications store their data in /home/user_name/ folder. Read how to move home folder to separate drive.
Increase size of root partition I know it is very obvious answer. But believe me, our data need changes over the time. I thought 20 GB /root mount would suffice but withing a year I have re-sized my root mount and increased to 50 GB.
8
sudo apt-get clean freed up more space than expected, +1
– btk
Mar 1 '14 at 2:46
Beware thatapt-get clean
removes even installed packages. You may want to keep those in case an upgrade fails.
– timss
Jul 12 '15 at 13:56
I cleaned my cache and it cleared up 10 Gb! +1
– Numeri
Feb 9 '16 at 16:55
add a comment
|
Recently I faced similar situation. Too many applications got installed and they started using my root mount space. I am listing out few steps which I followed and hoping that you could also use the same.
Clean apt-get cache. Following command will remove all downloaded deb files from apt-get cache directory.
Run this command:
sudo apt-get clean
Move /home mount point to different drive. Previously, my home folder was situated on root drive. So I moved my home folder to separate drive. This helped me to release lot of stress from root mount because most of applications store their data in /home/user_name/ folder. Read how to move home folder to separate drive.
Increase size of root partition I know it is very obvious answer. But believe me, our data need changes over the time. I thought 20 GB /root mount would suffice but withing a year I have re-sized my root mount and increased to 50 GB.
Recently I faced similar situation. Too many applications got installed and they started using my root mount space. I am listing out few steps which I followed and hoping that you could also use the same.
Clean apt-get cache. Following command will remove all downloaded deb files from apt-get cache directory.
Run this command:
sudo apt-get clean
Move /home mount point to different drive. Previously, my home folder was situated on root drive. So I moved my home folder to separate drive. This helped me to release lot of stress from root mount because most of applications store their data in /home/user_name/ folder. Read how to move home folder to separate drive.
Increase size of root partition I know it is very obvious answer. But believe me, our data need changes over the time. I thought 20 GB /root mount would suffice but withing a year I have re-sized my root mount and increased to 50 GB.
edited May 27 '16 at 19:49
Daan
1234 bronze badges
1234 bronze badges
answered Aug 20 '11 at 19:13
Amey JahAmey Jah
1,8352 gold badges19 silver badges33 bronze badges
1,8352 gold badges19 silver badges33 bronze badges
8
sudo apt-get clean freed up more space than expected, +1
– btk
Mar 1 '14 at 2:46
Beware thatapt-get clean
removes even installed packages. You may want to keep those in case an upgrade fails.
– timss
Jul 12 '15 at 13:56
I cleaned my cache and it cleared up 10 Gb! +1
– Numeri
Feb 9 '16 at 16:55
add a comment
|
8
sudo apt-get clean freed up more space than expected, +1
– btk
Mar 1 '14 at 2:46
Beware thatapt-get clean
removes even installed packages. You may want to keep those in case an upgrade fails.
– timss
Jul 12 '15 at 13:56
I cleaned my cache and it cleared up 10 Gb! +1
– Numeri
Feb 9 '16 at 16:55
8
8
sudo apt-get clean freed up more space than expected, +1
– btk
Mar 1 '14 at 2:46
sudo apt-get clean freed up more space than expected, +1
– btk
Mar 1 '14 at 2:46
Beware that
apt-get clean
removes even installed packages. You may want to keep those in case an upgrade fails.– timss
Jul 12 '15 at 13:56
Beware that
apt-get clean
removes even installed packages. You may want to keep those in case an upgrade fails.– timss
Jul 12 '15 at 13:56
I cleaned my cache and it cleared up 10 Gb! +1
– Numeri
Feb 9 '16 at 16:55
I cleaned my cache and it cleared up 10 Gb! +1
– Numeri
Feb 9 '16 at 16:55
add a comment
|
I successfully cleared 3.5 GB by removing old headers and images, using the following command:
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/(.*)-([^0-9]+)/1/")"'/d;s/^[^ ]* [^ ]* ([^ ]*).*/1/;/[0-9]/!d' | xargs sudo apt-get -y purge
You can check what packages will be purged executing the first part of the command:
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/(.*)-([^0-9]+)/1/")"'/d;s/^[^ ]* [^ ]* ([^ ]*).*/1/;/[0-9]/!d'
Reference
Other tips didn't help, but this saved me around 5G. Thanks.
– baltasvejas
Apr 14 '15 at 8:07
The option-y
in the apt-get command is not really necessary. If you omit it apt-get will ask you (only once), if all piped packages should be removed. Imho it's better to not use-y
, it gives you one more possibility to check (besides the second command mentioned above). For me this freed 15GB on the root partition!
– Boris Däppen
Jan 7 '17 at 13:03
1
The commanddpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/(.*)-([^0-9]+)/1/")"'/d;s/^[^ ]* [^ ]* ([^ ]*).*/1/;/[0-9]/!d' | xargs sudo apt-get -y purge
tried to remove the currently installed kernel version in my system. Be careful not to make your system unbootable.
– Antony
Aug 9 '18 at 12:50
@Antony yaikes! i was about to try this. how can i verify which are ok to delete ?
– Sonic Soul
Aug 28 '18 at 15:12
1
@SonicSoul I eventually ended up doing what one of the answers below (askubuntu.com/a/778442/333806) suggests. Basically, ranuname -r
to find the current kernel and took care not to remove it. If the command provided byhomebrand
to check which packages will be purged does not show the current kernel, then you should be safe running the purge command mentioned by him.
– Antony
Aug 29 '18 at 13:25
add a comment
|
I successfully cleared 3.5 GB by removing old headers and images, using the following command:
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/(.*)-([^0-9]+)/1/")"'/d;s/^[^ ]* [^ ]* ([^ ]*).*/1/;/[0-9]/!d' | xargs sudo apt-get -y purge
You can check what packages will be purged executing the first part of the command:
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/(.*)-([^0-9]+)/1/")"'/d;s/^[^ ]* [^ ]* ([^ ]*).*/1/;/[0-9]/!d'
Reference
Other tips didn't help, but this saved me around 5G. Thanks.
– baltasvejas
Apr 14 '15 at 8:07
The option-y
in the apt-get command is not really necessary. If you omit it apt-get will ask you (only once), if all piped packages should be removed. Imho it's better to not use-y
, it gives you one more possibility to check (besides the second command mentioned above). For me this freed 15GB on the root partition!
– Boris Däppen
Jan 7 '17 at 13:03
1
The commanddpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/(.*)-([^0-9]+)/1/")"'/d;s/^[^ ]* [^ ]* ([^ ]*).*/1/;/[0-9]/!d' | xargs sudo apt-get -y purge
tried to remove the currently installed kernel version in my system. Be careful not to make your system unbootable.
– Antony
Aug 9 '18 at 12:50
@Antony yaikes! i was about to try this. how can i verify which are ok to delete ?
– Sonic Soul
Aug 28 '18 at 15:12
1
@SonicSoul I eventually ended up doing what one of the answers below (askubuntu.com/a/778442/333806) suggests. Basically, ranuname -r
to find the current kernel and took care not to remove it. If the command provided byhomebrand
to check which packages will be purged does not show the current kernel, then you should be safe running the purge command mentioned by him.
– Antony
Aug 29 '18 at 13:25
add a comment
|
I successfully cleared 3.5 GB by removing old headers and images, using the following command:
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/(.*)-([^0-9]+)/1/")"'/d;s/^[^ ]* [^ ]* ([^ ]*).*/1/;/[0-9]/!d' | xargs sudo apt-get -y purge
You can check what packages will be purged executing the first part of the command:
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/(.*)-([^0-9]+)/1/")"'/d;s/^[^ ]* [^ ]* ([^ ]*).*/1/;/[0-9]/!d'
Reference
I successfully cleared 3.5 GB by removing old headers and images, using the following command:
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/(.*)-([^0-9]+)/1/")"'/d;s/^[^ ]* [^ ]* ([^ ]*).*/1/;/[0-9]/!d' | xargs sudo apt-get -y purge
You can check what packages will be purged executing the first part of the command:
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/(.*)-([^0-9]+)/1/")"'/d;s/^[^ ]* [^ ]* ([^ ]*).*/1/;/[0-9]/!d'
Reference
edited Apr 15 '18 at 13:04
answered Jul 8 '14 at 9:12
homebrandhomebrand
3703 silver badges5 bronze badges
3703 silver badges5 bronze badges
Other tips didn't help, but this saved me around 5G. Thanks.
– baltasvejas
Apr 14 '15 at 8:07
The option-y
in the apt-get command is not really necessary. If you omit it apt-get will ask you (only once), if all piped packages should be removed. Imho it's better to not use-y
, it gives you one more possibility to check (besides the second command mentioned above). For me this freed 15GB on the root partition!
– Boris Däppen
Jan 7 '17 at 13:03
1
The commanddpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/(.*)-([^0-9]+)/1/")"'/d;s/^[^ ]* [^ ]* ([^ ]*).*/1/;/[0-9]/!d' | xargs sudo apt-get -y purge
tried to remove the currently installed kernel version in my system. Be careful not to make your system unbootable.
– Antony
Aug 9 '18 at 12:50
@Antony yaikes! i was about to try this. how can i verify which are ok to delete ?
– Sonic Soul
Aug 28 '18 at 15:12
1
@SonicSoul I eventually ended up doing what one of the answers below (askubuntu.com/a/778442/333806) suggests. Basically, ranuname -r
to find the current kernel and took care not to remove it. If the command provided byhomebrand
to check which packages will be purged does not show the current kernel, then you should be safe running the purge command mentioned by him.
– Antony
Aug 29 '18 at 13:25
add a comment
|
Other tips didn't help, but this saved me around 5G. Thanks.
– baltasvejas
Apr 14 '15 at 8:07
The option-y
in the apt-get command is not really necessary. If you omit it apt-get will ask you (only once), if all piped packages should be removed. Imho it's better to not use-y
, it gives you one more possibility to check (besides the second command mentioned above). For me this freed 15GB on the root partition!
– Boris Däppen
Jan 7 '17 at 13:03
1
The commanddpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/(.*)-([^0-9]+)/1/")"'/d;s/^[^ ]* [^ ]* ([^ ]*).*/1/;/[0-9]/!d' | xargs sudo apt-get -y purge
tried to remove the currently installed kernel version in my system. Be careful not to make your system unbootable.
– Antony
Aug 9 '18 at 12:50
@Antony yaikes! i was about to try this. how can i verify which are ok to delete ?
– Sonic Soul
Aug 28 '18 at 15:12
1
@SonicSoul I eventually ended up doing what one of the answers below (askubuntu.com/a/778442/333806) suggests. Basically, ranuname -r
to find the current kernel and took care not to remove it. If the command provided byhomebrand
to check which packages will be purged does not show the current kernel, then you should be safe running the purge command mentioned by him.
– Antony
Aug 29 '18 at 13:25
Other tips didn't help, but this saved me around 5G. Thanks.
– baltasvejas
Apr 14 '15 at 8:07
Other tips didn't help, but this saved me around 5G. Thanks.
– baltasvejas
Apr 14 '15 at 8:07
The option
-y
in the apt-get command is not really necessary. If you omit it apt-get will ask you (only once), if all piped packages should be removed. Imho it's better to not use -y
, it gives you one more possibility to check (besides the second command mentioned above). For me this freed 15GB on the root partition!– Boris Däppen
Jan 7 '17 at 13:03
The option
-y
in the apt-get command is not really necessary. If you omit it apt-get will ask you (only once), if all piped packages should be removed. Imho it's better to not use -y
, it gives you one more possibility to check (besides the second command mentioned above). For me this freed 15GB on the root partition!– Boris Däppen
Jan 7 '17 at 13:03
1
1
The command
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/(.*)-([^0-9]+)/1/")"'/d;s/^[^ ]* [^ ]* ([^ ]*).*/1/;/[0-9]/!d' | xargs sudo apt-get -y purge
tried to remove the currently installed kernel version in my system. Be careful not to make your system unbootable.– Antony
Aug 9 '18 at 12:50
The command
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/(.*)-([^0-9]+)/1/")"'/d;s/^[^ ]* [^ ]* ([^ ]*).*/1/;/[0-9]/!d' | xargs sudo apt-get -y purge
tried to remove the currently installed kernel version in my system. Be careful not to make your system unbootable.– Antony
Aug 9 '18 at 12:50
@Antony yaikes! i was about to try this. how can i verify which are ok to delete ?
– Sonic Soul
Aug 28 '18 at 15:12
@Antony yaikes! i was about to try this. how can i verify which are ok to delete ?
– Sonic Soul
Aug 28 '18 at 15:12
1
1
@SonicSoul I eventually ended up doing what one of the answers below (askubuntu.com/a/778442/333806) suggests. Basically, ran
uname -r
to find the current kernel and took care not to remove it. If the command provided by homebrand
to check which packages will be purged does not show the current kernel, then you should be safe running the purge command mentioned by him.– Antony
Aug 29 '18 at 13:25
@SonicSoul I eventually ended up doing what one of the answers below (askubuntu.com/a/778442/333806) suggests. Basically, ran
uname -r
to find the current kernel and took care not to remove it. If the command provided by homebrand
to check which packages will be purged does not show the current kernel, then you should be safe running the purge command mentioned by him.– Antony
Aug 29 '18 at 13:25
add a comment
|
Use dpkg-query
to find the largest packages and remove the ones you don't need anymore (source):
dpkg-query --show --showformat='$Package;-50t$Installed-Sizen' | sort -k 2 -n | grep -v deinstall | awk 'printf "%.3f MB t %sn", $2/(1024), $1'
1
Now this is a really useful one-liner. Perfect for a quick summary of the biggest install packages. Come to my dotfiles!
– arainone
Jul 1 '16 at 18:27
You can get this withwajig sizes
– Pablo A
Oct 14 at 3:12
add a comment
|
Use dpkg-query
to find the largest packages and remove the ones you don't need anymore (source):
dpkg-query --show --showformat='$Package;-50t$Installed-Sizen' | sort -k 2 -n | grep -v deinstall | awk 'printf "%.3f MB t %sn", $2/(1024), $1'
1
Now this is a really useful one-liner. Perfect for a quick summary of the biggest install packages. Come to my dotfiles!
– arainone
Jul 1 '16 at 18:27
You can get this withwajig sizes
– Pablo A
Oct 14 at 3:12
add a comment
|
Use dpkg-query
to find the largest packages and remove the ones you don't need anymore (source):
dpkg-query --show --showformat='$Package;-50t$Installed-Sizen' | sort -k 2 -n | grep -v deinstall | awk 'printf "%.3f MB t %sn", $2/(1024), $1'
Use dpkg-query
to find the largest packages and remove the ones you don't need anymore (source):
dpkg-query --show --showformat='$Package;-50t$Installed-Sizen' | sort -k 2 -n | grep -v deinstall | awk 'printf "%.3f MB t %sn", $2/(1024), $1'
edited Oct 14 at 3:09
Pablo A
4,2102 gold badges21 silver badges48 bronze badges
4,2102 gold badges21 silver badges48 bronze badges
answered Aug 19 '14 at 13:43
michaeljosephmichaeljoseph
3412 silver badges4 bronze badges
3412 silver badges4 bronze badges
1
Now this is a really useful one-liner. Perfect for a quick summary of the biggest install packages. Come to my dotfiles!
– arainone
Jul 1 '16 at 18:27
You can get this withwajig sizes
– Pablo A
Oct 14 at 3:12
add a comment
|
1
Now this is a really useful one-liner. Perfect for a quick summary of the biggest install packages. Come to my dotfiles!
– arainone
Jul 1 '16 at 18:27
You can get this withwajig sizes
– Pablo A
Oct 14 at 3:12
1
1
Now this is a really useful one-liner. Perfect for a quick summary of the biggest install packages. Come to my dotfiles!
– arainone
Jul 1 '16 at 18:27
Now this is a really useful one-liner. Perfect for a quick summary of the biggest install packages. Come to my dotfiles!
– arainone
Jul 1 '16 at 18:27
You can get this with
wajig sizes
– Pablo A
Oct 14 at 3:12
You can get this with
wajig sizes
– Pablo A
Oct 14 at 3:12
add a comment
|
sudo apt autoclean # clean /var/cache/apt/archives folder which save packages while install.
sudo apt autoremove # this command remove unused packages.
sudo shutdown -rf # it will restart your PC immediately and check filesystem in next boot.
18
You provide no explanations. If someone was to just copy/paste your code, then the system would shut down with no warning, possibly causing a loss of data. Please don't provide commands without any explanation of what they do. -1
– Jo-Erlend Schinstad
Aug 20 '11 at 19:14
9
Why the need to check the filesystem?
– Nathan Osman
Aug 20 '11 at 21:46
add a comment
|
sudo apt autoclean # clean /var/cache/apt/archives folder which save packages while install.
sudo apt autoremove # this command remove unused packages.
sudo shutdown -rf # it will restart your PC immediately and check filesystem in next boot.
18
You provide no explanations. If someone was to just copy/paste your code, then the system would shut down with no warning, possibly causing a loss of data. Please don't provide commands without any explanation of what they do. -1
– Jo-Erlend Schinstad
Aug 20 '11 at 19:14
9
Why the need to check the filesystem?
– Nathan Osman
Aug 20 '11 at 21:46
add a comment
|
sudo apt autoclean # clean /var/cache/apt/archives folder which save packages while install.
sudo apt autoremove # this command remove unused packages.
sudo shutdown -rf # it will restart your PC immediately and check filesystem in next boot.
sudo apt autoclean # clean /var/cache/apt/archives folder which save packages while install.
sudo apt autoremove # this command remove unused packages.
sudo shutdown -rf # it will restart your PC immediately and check filesystem in next boot.
edited Oct 14 at 3:54
Pablo A
4,2102 gold badges21 silver badges48 bronze badges
4,2102 gold badges21 silver badges48 bronze badges
answered Aug 20 '11 at 19:01
shantanushantanu
4,99112 gold badges53 silver badges91 bronze badges
4,99112 gold badges53 silver badges91 bronze badges
18
You provide no explanations. If someone was to just copy/paste your code, then the system would shut down with no warning, possibly causing a loss of data. Please don't provide commands without any explanation of what they do. -1
– Jo-Erlend Schinstad
Aug 20 '11 at 19:14
9
Why the need to check the filesystem?
– Nathan Osman
Aug 20 '11 at 21:46
add a comment
|
18
You provide no explanations. If someone was to just copy/paste your code, then the system would shut down with no warning, possibly causing a loss of data. Please don't provide commands without any explanation of what they do. -1
– Jo-Erlend Schinstad
Aug 20 '11 at 19:14
9
Why the need to check the filesystem?
– Nathan Osman
Aug 20 '11 at 21:46
18
18
You provide no explanations. If someone was to just copy/paste your code, then the system would shut down with no warning, possibly causing a loss of data. Please don't provide commands without any explanation of what they do. -1
– Jo-Erlend Schinstad
Aug 20 '11 at 19:14
You provide no explanations. If someone was to just copy/paste your code, then the system would shut down with no warning, possibly causing a loss of data. Please don't provide commands without any explanation of what they do. -1
– Jo-Erlend Schinstad
Aug 20 '11 at 19:14
9
9
Why the need to check the filesystem?
– Nathan Osman
Aug 20 '11 at 21:46
Why the need to check the filesystem?
– Nathan Osman
Aug 20 '11 at 21:46
add a comment
|
Removing old kernel versions (as suggested already by homebrand) can free up a decent amount of space if you haven't yet got around to doing that.
There's a number of ways to remove the old kernel versions and a range of different options can be found in the answers posted to: How do I remove old kernel versions to clean up the boot menu?
My preferred method is mostly this answer from penreturns where it's broken down into fairly simple understandable steps:
Open terminal and check your current kernel:
uname -r
DO NOT REMOVE THIS KERNEL!
Next, type the command below to view/list all installed kernels on your system.
dpkg --list | grep linux-image
Find all the kernels that are lower than your current kernel.
When you know which kernel to remove, continue below to remove it.
Run the command below to remove the kernel you selected.
sudo apt-get purge linux-image-x.x.x.x-generic
The answer then says to 'update-grub2' when you're finished purging, which is likely to be out of date now: sudo update-grub
should suffice for Ubuntu 14.04 onward. They also then say to 'Reboot your system' (which seems to be so that you can see the cleaned up boot menu) so in this case isn't necessary.
The grub bootloader menu used to show all the older kernel versions on the main page, but they are now placed out of the way behind a sub-menu. It's much neater but a newcomer to Ubuntu/Linux may not be aware that they are there taking up space.
As suggested, don't remove the current kernel and it's also advisable to keep the previous kernel version too, just in case you need to roll back to that one.
There are faster ways to do this, but I prefer the simplicity of this method mainly because I can understand each command along the way:
"What kernel version am I using? What kernel versions do I have? Okay, purge that one."
Rinse, repeat, admire the space you've freed up.
It's fairly easy to copy the name of the specific older kernel you want to remove from the results that dpkg --list | grep linux-image
gives you in the terminal, and then use sudo apt-get purge
and paste the copied name in.
Removing 3 or 4 older kernels will usually free up about a GB of space in your root drive.
1
In addition to linux-image, you can also also grep for and purge linux-headers
– kdopen
Nov 3 '17 at 13:34
add a comment
|
Removing old kernel versions (as suggested already by homebrand) can free up a decent amount of space if you haven't yet got around to doing that.
There's a number of ways to remove the old kernel versions and a range of different options can be found in the answers posted to: How do I remove old kernel versions to clean up the boot menu?
My preferred method is mostly this answer from penreturns where it's broken down into fairly simple understandable steps:
Open terminal and check your current kernel:
uname -r
DO NOT REMOVE THIS KERNEL!
Next, type the command below to view/list all installed kernels on your system.
dpkg --list | grep linux-image
Find all the kernels that are lower than your current kernel.
When you know which kernel to remove, continue below to remove it.
Run the command below to remove the kernel you selected.
sudo apt-get purge linux-image-x.x.x.x-generic
The answer then says to 'update-grub2' when you're finished purging, which is likely to be out of date now: sudo update-grub
should suffice for Ubuntu 14.04 onward. They also then say to 'Reboot your system' (which seems to be so that you can see the cleaned up boot menu) so in this case isn't necessary.
The grub bootloader menu used to show all the older kernel versions on the main page, but they are now placed out of the way behind a sub-menu. It's much neater but a newcomer to Ubuntu/Linux may not be aware that they are there taking up space.
As suggested, don't remove the current kernel and it's also advisable to keep the previous kernel version too, just in case you need to roll back to that one.
There are faster ways to do this, but I prefer the simplicity of this method mainly because I can understand each command along the way:
"What kernel version am I using? What kernel versions do I have? Okay, purge that one."
Rinse, repeat, admire the space you've freed up.
It's fairly easy to copy the name of the specific older kernel you want to remove from the results that dpkg --list | grep linux-image
gives you in the terminal, and then use sudo apt-get purge
and paste the copied name in.
Removing 3 or 4 older kernels will usually free up about a GB of space in your root drive.
1
In addition to linux-image, you can also also grep for and purge linux-headers
– kdopen
Nov 3 '17 at 13:34
add a comment
|
Removing old kernel versions (as suggested already by homebrand) can free up a decent amount of space if you haven't yet got around to doing that.
There's a number of ways to remove the old kernel versions and a range of different options can be found in the answers posted to: How do I remove old kernel versions to clean up the boot menu?
My preferred method is mostly this answer from penreturns where it's broken down into fairly simple understandable steps:
Open terminal and check your current kernel:
uname -r
DO NOT REMOVE THIS KERNEL!
Next, type the command below to view/list all installed kernels on your system.
dpkg --list | grep linux-image
Find all the kernels that are lower than your current kernel.
When you know which kernel to remove, continue below to remove it.
Run the command below to remove the kernel you selected.
sudo apt-get purge linux-image-x.x.x.x-generic
The answer then says to 'update-grub2' when you're finished purging, which is likely to be out of date now: sudo update-grub
should suffice for Ubuntu 14.04 onward. They also then say to 'Reboot your system' (which seems to be so that you can see the cleaned up boot menu) so in this case isn't necessary.
The grub bootloader menu used to show all the older kernel versions on the main page, but they are now placed out of the way behind a sub-menu. It's much neater but a newcomer to Ubuntu/Linux may not be aware that they are there taking up space.
As suggested, don't remove the current kernel and it's also advisable to keep the previous kernel version too, just in case you need to roll back to that one.
There are faster ways to do this, but I prefer the simplicity of this method mainly because I can understand each command along the way:
"What kernel version am I using? What kernel versions do I have? Okay, purge that one."
Rinse, repeat, admire the space you've freed up.
It's fairly easy to copy the name of the specific older kernel you want to remove from the results that dpkg --list | grep linux-image
gives you in the terminal, and then use sudo apt-get purge
and paste the copied name in.
Removing 3 or 4 older kernels will usually free up about a GB of space in your root drive.
Removing old kernel versions (as suggested already by homebrand) can free up a decent amount of space if you haven't yet got around to doing that.
There's a number of ways to remove the old kernel versions and a range of different options can be found in the answers posted to: How do I remove old kernel versions to clean up the boot menu?
My preferred method is mostly this answer from penreturns where it's broken down into fairly simple understandable steps:
Open terminal and check your current kernel:
uname -r
DO NOT REMOVE THIS KERNEL!
Next, type the command below to view/list all installed kernels on your system.
dpkg --list | grep linux-image
Find all the kernels that are lower than your current kernel.
When you know which kernel to remove, continue below to remove it.
Run the command below to remove the kernel you selected.
sudo apt-get purge linux-image-x.x.x.x-generic
The answer then says to 'update-grub2' when you're finished purging, which is likely to be out of date now: sudo update-grub
should suffice for Ubuntu 14.04 onward. They also then say to 'Reboot your system' (which seems to be so that you can see the cleaned up boot menu) so in this case isn't necessary.
The grub bootloader menu used to show all the older kernel versions on the main page, but they are now placed out of the way behind a sub-menu. It's much neater but a newcomer to Ubuntu/Linux may not be aware that they are there taking up space.
As suggested, don't remove the current kernel and it's also advisable to keep the previous kernel version too, just in case you need to roll back to that one.
There are faster ways to do this, but I prefer the simplicity of this method mainly because I can understand each command along the way:
"What kernel version am I using? What kernel versions do I have? Okay, purge that one."
Rinse, repeat, admire the space you've freed up.
It's fairly easy to copy the name of the specific older kernel you want to remove from the results that dpkg --list | grep linux-image
gives you in the terminal, and then use sudo apt-get purge
and paste the copied name in.
Removing 3 or 4 older kernels will usually free up about a GB of space in your root drive.
edited Oct 14 at 3:47
Pablo A
4,2102 gold badges21 silver badges48 bronze badges
4,2102 gold badges21 silver badges48 bronze badges
answered May 27 '16 at 22:31
pHeLiOnpHeLiOn
1,0907 silver badges21 bronze badges
1,0907 silver badges21 bronze badges
1
In addition to linux-image, you can also also grep for and purge linux-headers
– kdopen
Nov 3 '17 at 13:34
add a comment
|
1
In addition to linux-image, you can also also grep for and purge linux-headers
– kdopen
Nov 3 '17 at 13:34
1
1
In addition to linux-image, you can also also grep for and purge linux-headers
– kdopen
Nov 3 '17 at 13:34
In addition to linux-image, you can also also grep for and purge linux-headers
– kdopen
Nov 3 '17 at 13:34
add a comment
|
Following the instructions on the Ubuntu community docs I discovered a massive trash file -- it looked like a backup of /var/log/syslog.1, presumably something was spewing loads of output to syslog...
The command that found it was:
sudo find / -size +1G
And then any large file in a folder called .Trash
is probably good to delete...
add a comment
|
Following the instructions on the Ubuntu community docs I discovered a massive trash file -- it looked like a backup of /var/log/syslog.1, presumably something was spewing loads of output to syslog...
The command that found it was:
sudo find / -size +1G
And then any large file in a folder called .Trash
is probably good to delete...
add a comment
|
Following the instructions on the Ubuntu community docs I discovered a massive trash file -- it looked like a backup of /var/log/syslog.1, presumably something was spewing loads of output to syslog...
The command that found it was:
sudo find / -size +1G
And then any large file in a folder called .Trash
is probably good to delete...
Following the instructions on the Ubuntu community docs I discovered a massive trash file -- it looked like a backup of /var/log/syslog.1, presumably something was spewing loads of output to syslog...
The command that found it was:
sudo find / -size +1G
And then any large file in a folder called .Trash
is probably good to delete...
answered Jun 9 '14 at 12:35
hwjphwjp
7447 silver badges19 bronze badges
7447 silver badges19 bronze badges
add a comment
|
add a comment
|
When I need make more free space on servers I use this command:
find / -type f -size +50M -exec du -h ; | sort -n
It finds all files bigger than 50 MB and "du -h
" make a better list of files and "sort -n
" after pipe make list numerically sorted by file size.
add a comment
|
When I need make more free space on servers I use this command:
find / -type f -size +50M -exec du -h ; | sort -n
It finds all files bigger than 50 MB and "du -h
" make a better list of files and "sort -n
" after pipe make list numerically sorted by file size.
add a comment
|
When I need make more free space on servers I use this command:
find / -type f -size +50M -exec du -h ; | sort -n
It finds all files bigger than 50 MB and "du -h
" make a better list of files and "sort -n
" after pipe make list numerically sorted by file size.
When I need make more free space on servers I use this command:
find / -type f -size +50M -exec du -h ; | sort -n
It finds all files bigger than 50 MB and "du -h
" make a better list of files and "sort -n
" after pipe make list numerically sorted by file size.
edited Oct 14 at 4:04
Pablo A
4,2102 gold badges21 silver badges48 bronze badges
4,2102 gold badges21 silver badges48 bronze badges
answered Oct 11 '14 at 20:29
zorbon.czzorbon.cz
90611 silver badges15 bronze badges
90611 silver badges15 bronze badges
add a comment
|
add a comment
|
Here is a script I run to free space on root partition
function myclean sed '/^ii/!d;/'"$(uname -r
Edit : New 2 lines old kernels cleaner
– cmak.fr
Aug 30 at 15:54
Thanks! "Rotate and delete old logs" clear up several gigs on my drive.
– SaTa
Sep 30 at 2:21
Nice. Developers may also want to remove their unused docker images:docker system prune
– Pablo A
Oct 14 at 4:08
@Pablo A they may look to/var/crash/*.crash
too
– cmak.fr
Oct 14 at 6:25
add a comment
|
Here is a script I run to free space on root partition
function myclean sed '/^ii/!d;/'"$(uname -r
Edit : New 2 lines old kernels cleaner
– cmak.fr
Aug 30 at 15:54
Thanks! "Rotate and delete old logs" clear up several gigs on my drive.
– SaTa
Sep 30 at 2:21
Nice. Developers may also want to remove their unused docker images:docker system prune
– Pablo A
Oct 14 at 4:08
@Pablo A they may look to/var/crash/*.crash
too
– cmak.fr
Oct 14 at 6:25
add a comment
|
Here is a script I run to free space on root partition
function myclean sed '/^ii/!d;/'"$(uname -r
Here is a script I run to free space on root partition
function myclean sed '/^ii/!d;/'"$(uname -r
edited Oct 14 at 3:56
Pablo A
4,2102 gold badges21 silver badges48 bronze badges
4,2102 gold badges21 silver badges48 bronze badges
answered Jul 26 at 8:50
cmak.frcmak.fr
3,6921 gold badge15 silver badges30 bronze badges
3,6921 gold badge15 silver badges30 bronze badges
Edit : New 2 lines old kernels cleaner
– cmak.fr
Aug 30 at 15:54
Thanks! "Rotate and delete old logs" clear up several gigs on my drive.
– SaTa
Sep 30 at 2:21
Nice. Developers may also want to remove their unused docker images:docker system prune
– Pablo A
Oct 14 at 4:08
@Pablo A they may look to/var/crash/*.crash
too
– cmak.fr
Oct 14 at 6:25
add a comment
|
Edit : New 2 lines old kernels cleaner
– cmak.fr
Aug 30 at 15:54
Thanks! "Rotate and delete old logs" clear up several gigs on my drive.
– SaTa
Sep 30 at 2:21
Nice. Developers may also want to remove their unused docker images:docker system prune
– Pablo A
Oct 14 at 4:08
@Pablo A they may look to/var/crash/*.crash
too
– cmak.fr
Oct 14 at 6:25
Edit : New 2 lines old kernels cleaner
– cmak.fr
Aug 30 at 15:54
Edit : New 2 lines old kernels cleaner
– cmak.fr
Aug 30 at 15:54
Thanks! "Rotate and delete old logs" clear up several gigs on my drive.
– SaTa
Sep 30 at 2:21
Thanks! "Rotate and delete old logs" clear up several gigs on my drive.
– SaTa
Sep 30 at 2:21
Nice. Developers may also want to remove their unused docker images:
docker system prune
– Pablo A
Oct 14 at 4:08
Nice. Developers may also want to remove their unused docker images:
docker system prune
– Pablo A
Oct 14 at 4:08
@Pablo A they may look to
/var/crash/*.crash
too– cmak.fr
Oct 14 at 6:25
@Pablo A they may look to
/var/crash/*.crash
too– cmak.fr
Oct 14 at 6:25
add a comment
|
In Ubuntu, each folder can have its own filesystem. That means you can move any folder onto its own partition, another disk or even on a remote network. This is particularly popular for home directories, since that means you can reinstall Ubuntu without changing your personal settings or loosing any files. It's also popular in networks where users should be able to log onto different machines and still get their personal settings and files. But it is useful in many different cases, such as yours.
Applications aren't installed into a specific folder, like you seem to suggest. Different parts of the application is placed in different parts of the filesystem. The main program is usually placed in /usr/bin, whereas configuration files are placed in /etc, for instance. In your case, MySQL, the databases themselves are placed somewhere in /var. I think /var/mysql.
Since /usr and /var are both directories in the root filesystem, they will use the root filesystems space. But as I said, you can move them to different filesystems. In the case of MySQL, you can configure where databases are stored. You could easily move databases to /home/username/.mysql/databases for instance.
add a comment
|
In Ubuntu, each folder can have its own filesystem. That means you can move any folder onto its own partition, another disk or even on a remote network. This is particularly popular for home directories, since that means you can reinstall Ubuntu without changing your personal settings or loosing any files. It's also popular in networks where users should be able to log onto different machines and still get their personal settings and files. But it is useful in many different cases, such as yours.
Applications aren't installed into a specific folder, like you seem to suggest. Different parts of the application is placed in different parts of the filesystem. The main program is usually placed in /usr/bin, whereas configuration files are placed in /etc, for instance. In your case, MySQL, the databases themselves are placed somewhere in /var. I think /var/mysql.
Since /usr and /var are both directories in the root filesystem, they will use the root filesystems space. But as I said, you can move them to different filesystems. In the case of MySQL, you can configure where databases are stored. You could easily move databases to /home/username/.mysql/databases for instance.
add a comment
|
In Ubuntu, each folder can have its own filesystem. That means you can move any folder onto its own partition, another disk or even on a remote network. This is particularly popular for home directories, since that means you can reinstall Ubuntu without changing your personal settings or loosing any files. It's also popular in networks where users should be able to log onto different machines and still get their personal settings and files. But it is useful in many different cases, such as yours.
Applications aren't installed into a specific folder, like you seem to suggest. Different parts of the application is placed in different parts of the filesystem. The main program is usually placed in /usr/bin, whereas configuration files are placed in /etc, for instance. In your case, MySQL, the databases themselves are placed somewhere in /var. I think /var/mysql.
Since /usr and /var are both directories in the root filesystem, they will use the root filesystems space. But as I said, you can move them to different filesystems. In the case of MySQL, you can configure where databases are stored. You could easily move databases to /home/username/.mysql/databases for instance.
In Ubuntu, each folder can have its own filesystem. That means you can move any folder onto its own partition, another disk or even on a remote network. This is particularly popular for home directories, since that means you can reinstall Ubuntu without changing your personal settings or loosing any files. It's also popular in networks where users should be able to log onto different machines and still get their personal settings and files. But it is useful in many different cases, such as yours.
Applications aren't installed into a specific folder, like you seem to suggest. Different parts of the application is placed in different parts of the filesystem. The main program is usually placed in /usr/bin, whereas configuration files are placed in /etc, for instance. In your case, MySQL, the databases themselves are placed somewhere in /var. I think /var/mysql.
Since /usr and /var are both directories in the root filesystem, they will use the root filesystems space. But as I said, you can move them to different filesystems. In the case of MySQL, you can configure where databases are stored. You could easily move databases to /home/username/.mysql/databases for instance.
answered Aug 20 '11 at 19:22
Jo-Erlend SchinstadJo-Erlend Schinstad
26.7k5 gold badges59 silver badges109 bronze badges
26.7k5 gold badges59 silver badges109 bronze badges
add a comment
|
add a comment
|
You cannot change the path where the package manager install applications. Most application files are saved to /usr
. If you want to recover space on the root partition, moving /usr
to a different partition is a possible solution.
From comments:
Preserve the permissions when copying, i.e. better use the command line if you are unsure what your file manager will do.
The right way to this, is to mount a new filesystem to /usr or use
mount --bind
. It's not clear how well a symlink would work.
careful about move /usr. use cp command to copy usr folder with same permission. then delete original /usr folder and create a link of usr folder on / .
– shantanu
Aug 20 '11 at 19:04
1
It should have a mount point. Not a link.
– Jo-Erlend Schinstad
Aug 20 '11 at 19:12
Small note: a lot of applications also install binaries and application data into/opt
.
– Nathan Osman
Aug 20 '11 at 21:45
@george-edison Well, some applications install stuff in/opt
against "the rules".
– Jan
Aug 20 '11 at 21:57
add a comment
|
You cannot change the path where the package manager install applications. Most application files are saved to /usr
. If you want to recover space on the root partition, moving /usr
to a different partition is a possible solution.
From comments:
Preserve the permissions when copying, i.e. better use the command line if you are unsure what your file manager will do.
The right way to this, is to mount a new filesystem to /usr or use
mount --bind
. It's not clear how well a symlink would work.
careful about move /usr. use cp command to copy usr folder with same permission. then delete original /usr folder and create a link of usr folder on / .
– shantanu
Aug 20 '11 at 19:04
1
It should have a mount point. Not a link.
– Jo-Erlend Schinstad
Aug 20 '11 at 19:12
Small note: a lot of applications also install binaries and application data into/opt
.
– Nathan Osman
Aug 20 '11 at 21:45
@george-edison Well, some applications install stuff in/opt
against "the rules".
– Jan
Aug 20 '11 at 21:57
add a comment
|
You cannot change the path where the package manager install applications. Most application files are saved to /usr
. If you want to recover space on the root partition, moving /usr
to a different partition is a possible solution.
From comments:
Preserve the permissions when copying, i.e. better use the command line if you are unsure what your file manager will do.
The right way to this, is to mount a new filesystem to /usr or use
mount --bind
. It's not clear how well a symlink would work.
You cannot change the path where the package manager install applications. Most application files are saved to /usr
. If you want to recover space on the root partition, moving /usr
to a different partition is a possible solution.
From comments:
Preserve the permissions when copying, i.e. better use the command line if you are unsure what your file manager will do.
The right way to this, is to mount a new filesystem to /usr or use
mount --bind
. It's not clear how well a symlink would work.
edited Aug 20 '11 at 19:27
answered Aug 20 '11 at 18:56
JanJan
2,4634 gold badges29 silver badges42 bronze badges
2,4634 gold badges29 silver badges42 bronze badges
careful about move /usr. use cp command to copy usr folder with same permission. then delete original /usr folder and create a link of usr folder on / .
– shantanu
Aug 20 '11 at 19:04
1
It should have a mount point. Not a link.
– Jo-Erlend Schinstad
Aug 20 '11 at 19:12
Small note: a lot of applications also install binaries and application data into/opt
.
– Nathan Osman
Aug 20 '11 at 21:45
@george-edison Well, some applications install stuff in/opt
against "the rules".
– Jan
Aug 20 '11 at 21:57
add a comment
|
careful about move /usr. use cp command to copy usr folder with same permission. then delete original /usr folder and create a link of usr folder on / .
– shantanu
Aug 20 '11 at 19:04
1
It should have a mount point. Not a link.
– Jo-Erlend Schinstad
Aug 20 '11 at 19:12
Small note: a lot of applications also install binaries and application data into/opt
.
– Nathan Osman
Aug 20 '11 at 21:45
@george-edison Well, some applications install stuff in/opt
against "the rules".
– Jan
Aug 20 '11 at 21:57
careful about move /usr. use cp command to copy usr folder with same permission. then delete original /usr folder and create a link of usr folder on / .
– shantanu
Aug 20 '11 at 19:04
careful about move /usr. use cp command to copy usr folder with same permission. then delete original /usr folder and create a link of usr folder on / .
– shantanu
Aug 20 '11 at 19:04
1
1
It should have a mount point. Not a link.
– Jo-Erlend Schinstad
Aug 20 '11 at 19:12
It should have a mount point. Not a link.
– Jo-Erlend Schinstad
Aug 20 '11 at 19:12
Small note: a lot of applications also install binaries and application data into
/opt
.– Nathan Osman
Aug 20 '11 at 21:45
Small note: a lot of applications also install binaries and application data into
/opt
.– Nathan Osman
Aug 20 '11 at 21:45
@george-edison Well, some applications install stuff in
/opt
against "the rules".– Jan
Aug 20 '11 at 21:57
@george-edison Well, some applications install stuff in
/opt
against "the rules".– Jan
Aug 20 '11 at 21:57
add a comment
|
If you have a lot of seperate filesystems, the following trick might prove handy: Mount / another time, but this time under /mnt. Now all of your searching for large or many files can be done, without traversing wrong fileystems.
It can also help you find the files that are hidden under another mount.
add a comment
|
If you have a lot of seperate filesystems, the following trick might prove handy: Mount / another time, but this time under /mnt. Now all of your searching for large or many files can be done, without traversing wrong fileystems.
It can also help you find the files that are hidden under another mount.
add a comment
|
If you have a lot of seperate filesystems, the following trick might prove handy: Mount / another time, but this time under /mnt. Now all of your searching for large or many files can be done, without traversing wrong fileystems.
It can also help you find the files that are hidden under another mount.
If you have a lot of seperate filesystems, the following trick might prove handy: Mount / another time, but this time under /mnt. Now all of your searching for large or many files can be done, without traversing wrong fileystems.
It can also help you find the files that are hidden under another mount.
answered Apr 19 '16 at 12:46
steviethecatsteviethecat
1192 bronze badges
1192 bronze badges
add a comment
|
add a comment
|
As of today it's better to use the new feature (since 14.04) to remove older kernel images:
sudo apt autoremove
Check out more details: Why doesn't Ubuntu remove old kernels automatically?
add a comment
|
As of today it's better to use the new feature (since 14.04) to remove older kernel images:
sudo apt autoremove
Check out more details: Why doesn't Ubuntu remove old kernels automatically?
add a comment
|
As of today it's better to use the new feature (since 14.04) to remove older kernel images:
sudo apt autoremove
Check out more details: Why doesn't Ubuntu remove old kernels automatically?
As of today it's better to use the new feature (since 14.04) to remove older kernel images:
sudo apt autoremove
Check out more details: Why doesn't Ubuntu remove old kernels automatically?
edited Oct 14 at 3:53
Pablo A
4,2102 gold badges21 silver badges48 bronze badges
4,2102 gold badges21 silver badges48 bronze badges
answered Sep 19 '17 at 13:21
ywuywu
112 bronze badges
112 bronze badges
add a comment
|
add a comment
|
If you have mssql database server installed, that can eat up your memory. Run NCurses Disk Usage
$ sudo ncdu /
To check what folders and files are taking max storage. The mssql data are usually stored on
/var/opt/mssql/backup/
The Question states that the Database needs to remain.
– Stephen Rauch
Jun 30 '18 at 17:28
The question mentioned MySql Database so if he is to remove the MsSQL database data then i guess that seems a pretty fair answer.
– Yogesh
Jul 2 '18 at 3:48
Might be useful the-x
option
– Pablo A
Oct 14 at 3:52
add a comment
|
If you have mssql database server installed, that can eat up your memory. Run NCurses Disk Usage
$ sudo ncdu /
To check what folders and files are taking max storage. The mssql data are usually stored on
/var/opt/mssql/backup/
The Question states that the Database needs to remain.
– Stephen Rauch
Jun 30 '18 at 17:28
The question mentioned MySql Database so if he is to remove the MsSQL database data then i guess that seems a pretty fair answer.
– Yogesh
Jul 2 '18 at 3:48
Might be useful the-x
option
– Pablo A
Oct 14 at 3:52
add a comment
|
If you have mssql database server installed, that can eat up your memory. Run NCurses Disk Usage
$ sudo ncdu /
To check what folders and files are taking max storage. The mssql data are usually stored on
/var/opt/mssql/backup/
If you have mssql database server installed, that can eat up your memory. Run NCurses Disk Usage
$ sudo ncdu /
To check what folders and files are taking max storage. The mssql data are usually stored on
/var/opt/mssql/backup/
edited Oct 14 at 3:51
Pablo A
4,2102 gold badges21 silver badges48 bronze badges
4,2102 gold badges21 silver badges48 bronze badges
answered Jun 30 '18 at 17:09
YogeshYogesh
1011 bronze badge
1011 bronze badge
The Question states that the Database needs to remain.
– Stephen Rauch
Jun 30 '18 at 17:28
The question mentioned MySql Database so if he is to remove the MsSQL database data then i guess that seems a pretty fair answer.
– Yogesh
Jul 2 '18 at 3:48
Might be useful the-x
option
– Pablo A
Oct 14 at 3:52
add a comment
|
The Question states that the Database needs to remain.
– Stephen Rauch
Jun 30 '18 at 17:28
The question mentioned MySql Database so if he is to remove the MsSQL database data then i guess that seems a pretty fair answer.
– Yogesh
Jul 2 '18 at 3:48
Might be useful the-x
option
– Pablo A
Oct 14 at 3:52
The Question states that the Database needs to remain.
– Stephen Rauch
Jun 30 '18 at 17:28
The Question states that the Database needs to remain.
– Stephen Rauch
Jun 30 '18 at 17:28
The question mentioned MySql Database so if he is to remove the MsSQL database data then i guess that seems a pretty fair answer.
– Yogesh
Jul 2 '18 at 3:48
The question mentioned MySql Database so if he is to remove the MsSQL database data then i guess that seems a pretty fair answer.
– Yogesh
Jul 2 '18 at 3:48
Might be useful the
-x
option– Pablo A
Oct 14 at 3:52
Might be useful the
-x
option– Pablo A
Oct 14 at 3:52
add a comment
|
Thanks for contributing an answer to Ask Ubuntu!
- 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%2faskubuntu.com%2fquestions%2f57994%2froot-drive-is-running-out-of-disk-space-how-can-i-free-up-space%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