Score:5

How to locate and clean /dev/nvme0n1p2?

cx flag

When I execute df -H I get:

/dev/nvme0n1p2 63G 42G 18G 70% /

I'd like to clean this partition as it has 70% used space, but how do I locate it? Where are the files?

If I do disc space check with sudo du -h --max-depth=1 / | sort -h, I get

0   /proc
0   /sys
4.0K    /cdrom
4.0K    /dev
4.0K    /srv
8.0K    /media
8.0K    /mnt
16K /lost+found
768K    /tmp
3.0M    /run
14M /etc
180M    /root
561M    /boot
5.6G    /opt
8.1G    /snap
13G /var
21G /usr
176G    /home
222G    /

This means the / takes up 222 GB, but the above partition at / only 42?

Artur Meinild avatar
vn flag
It seems you have another disk for the `/home` directory. Most data on `/` is in `/var` and `usr`. Try running the same command in these directories, maybe with `--max-depth=2` to find out where the data is located.
Sam Koelle avatar
ro flag
I am also having this issue. Running `docker system prune` reduced usage to 70% from 100% for me but I am trying to get this even lower.
Score:19
cn flag

The / is the root of the system. Everything else is mounted on subdirectories of /. You can see this more clearly if you look at the output of mount or lsblk. For example, on my system:

$ lsblk 
NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
nvme0n1     259:0    0 953.9G  0 disk  
├─nvme0n1p1 259:1    0   260M  0 part  
├─nvme0n1p2 259:2    0    16M  0 part  
├─nvme0n1p3 259:3    0   186G  0 part  
├─nvme0n1p4 259:4    0  1000M  0 part  
├─nvme0n1p5 259:5    0  56.6G  0 part  /
├─nvme0n1p6 259:6    0 680.1G  0 part  
│ └─home    254:0    0 680.1G  0 crypt /home
└─nvme0n1p7 259:7    0    30G  0 part  [SWAP]

This tells me that the partition nvme0n1p5 is mounted at / and the partition nvme0n1p6 is mounted on /home, a subdirectory of /.

When you do du /, that will search through / and any subdirectories, even if they are on a different file system. This is why you see 222 GB: you are also checking other partitions in addition to nvme0n1p2 because they are presumably mounted somewhere under /. Most likely your /home is on a different partition, as is the case on my system, since your /home is reported at 176G and 222G - 176G = 46G, which agrees with the output of df.

To see only the usage of / and nothing else, you need the -x flag. From man du:

  -x, --one-file-system
          skip directories on different file systems

Again, using my system as an example, your original command gives me:

$ sudo du -h --max-depth=1 / | sort -h
0   /proc
0   /sys
12K /srv
16K /lost+found
2.1M    /run
23M /tmp
27M /etc
54M /dev
71M /boot.old
72M /boot
315M    /root
2.1G    /opt
20G /var
21G /usr
228G    /home
270G    /

But if I add -x, I get the expected output:

$ sudo du -xh --max-depth=1 / | sort -h
12K /srv
16K /lost+found
27M /etc
71M /boot.old
72M /boot
315M    /root
2.1G    /opt
20G /var
21G /usr
43G /
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.