DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 25th August 2022
Woden27 Woden27 is offline
Port Guard
 
Join Date: May 2022
Posts: 12
Default /dev/sd0a is full?

Hi,

File system mounted on /dev/sd0a on / result as full.

Code:
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/sd0a      600M    600M  -29.9M   105%    /

Any idea on how to free space and why it happened?

Thanks.

Last edited by J65nko; 9th September 2022 at 07:05 PM. Reason: Added [code] and [/code] tags
Reply With Quote
  #2   (View Single Post)  
Old 25th August 2022
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,131
Default

To figure it out we would have to know the partition layout. What is the output of $ df -h and $ ls -l / | grep '^d'?

On an old decommissioned Alix system :
Code:
# df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/wd0a      873M   72.4M    757M     9%    /
/dev/wd0e      376M   86.9M    271M    24%    /home
/dev/wd0d      2.2G    185M    1.9G     9%    /usr
mfs:19936     37.7M    3.3M   32.5M     9%    /var
Here /home, /usr, /var each have their own separate partition. So they could never be the cause of a full / directory.
A listing of the root partition:
Code:
# ls -l /
ls -l /
total 35142
-rw-r--r--   1 root  wheel       578 Dec 12  2015 .cshrc
-rw-r--r--   1 root  wheel       522 Dec 13  2015 .profile
drwxr-xr-x   3 root  wheel       512 Jan 11  2016 Template.mfs
drwxr-xr-x   2 root  wheel       512 Dec 12  2015 altroot
drwxr-xr-x   2 root  wheel      1024 Dec 12  2015 bin
-rw-r--r--   1 root  wheel     71836 Dec 13  2015 boot
-rw-r--r--   1 root  wheel  10752916 Dec 13  2015 bsd
-rw-r--r--   1 root  wheel   7052251 Dec 13  2015 bsd.rd
drwxr-xr-x   3 root  wheel     19456 Aug 18 08:41 dev
drwxr-xr-x  20 root  wheel      2048 Aug 21 15:02 etc
drwxr-xr-x   4 root  wheel       512 Jun  2  2021 home
-rwxrw----   1 root  wheel       251 Dec 13  2015 install.site
drwxr-xr-x   2 root  wheel       512 Dec 12  2015 mnt
-rwxrw----   1 root  wheel     10640 Dec 13  2015 postinstall_alix
drwx------   4 root  wheel      2048 Aug 21 12:25 root
drwxr-xr-x   2 root  wheel      1536 Dec 12  2015 sbin
drwxrwxrwt   3 root  wheel       512 Aug 25 09:14 tmp
drwxr-xr-x  15 root  wheel       512 Dec 13  2015 usr
drwxr-xr-x  20 root  wheel       512 Dec 13  2015 var
We see a mix of directories and some files.
To see only the files that could be the culprits for filling up the root directory:
Code:
# ls -l / | grep -v '^d'
total 35142
-rw-r--r--   1 root  wheel       578 Dec 12  2015 .cshrc
-rw-r--r--   1 root  wheel       522 Dec 13  2015 .profile
-rw-r--r--   1 root  wheel     71836 Dec 13  2015 boot
-rw-r--r--   1 root  wheel  10752916 Dec 13  2015 bsd
-rw-r--r--   1 root  wheel   7052251 Dec 13  2015 bsd.rd
-rwxrw----   1 root  wheel       251 Dec 13  2015 install.site
-rwxrw----   1 root  wheel     10640 Dec 13  2015 postinstall_alix
The directories that could contain large files :
Code:
# ls -l / | grep '^d'
drwxr-xr-x   3 root  wheel       512 Jan 11  2016 Template.mfs
drwxr-xr-x   2 root  wheel       512 Dec 12  2015 altroot
drwxr-xr-x   2 root  wheel      1024 Dec 12  2015 bin
drwxr-xr-x   3 root  wheel     19456 Aug 18 08:41 dev
drwxr-xr-x  20 root  wheel      2048 Aug 21 15:02 etc
drwxr-xr-x   4 root  wheel       512 Jun  2  2021 home
drwxr-xr-x   2 root  wheel       512 Dec 12  2015 mnt
drwx------   4 root  wheel      2048 Aug 21 12:25 root
drwxr-xr-x   2 root  wheel      1536 Dec 12  2015 sbin
drwxrwxrwt   3 root  wheel       512 Aug 25 09:14 tmp
drwxr-xr-x  15 root  wheel       512 Dec 13  2015 usr
drwxr-xr-x  20 root  wheel       512 Dec 13  2015 var
The ones in green color are the separate partitions that we saw in the # df -h output. Because they are mounted on "/" they show up in this listing, but could never be the cause of filling up '/". But a big file in all the other ones could be the cause.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump

Last edited by J65nko; 25th August 2022 at 07:57 AM.
Reply With Quote
  #3   (View Single Post)  
Old 25th August 2022
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,131
Default

Knowing the directories where the big ones could be hanging out, we can use the following command to sort sub-directories by size. For /etc/ this would be:
Code:
# du /etc | sort -rnk1 | less
 
9056    /etc
4624    /etc/firmware
636     /etc/ssl
292     /etc/rc.d
172     /etc/examples
148     /etc/mail
80      /etc/mtree
72      /etc/ldap
64      /etc/signify
[snip]
4       /etc/iked/ca
4       /etc/hotplug
4       /etc/authpf
Repeat for the other directories .......
See du(1) and sort(1)
The options for sort:
  • -r reverse sort
  • -n do numeric sort
  • -k1 use the first field as key to sort on.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump

Last edited by J65nko; 25th August 2022 at 08:18 AM.
Reply With Quote
  #4   (View Single Post)  
Old 9th September 2022
Woden27 Woden27 is offline
Port Guard
 
Join Date: May 2022
Posts: 12
Default

Hi,

thanks for Your reply.

I tried with :

Code:
BSD_Network_test# ls -l / | grep -v '^d'
total 143944
-rw-r--r--   1 root  wheel       578 Apr 12 08:45 .cshrc
-rw-r--r--   1 root  wheel       468 Apr 12 08:45 .profile
-rw-r--r--   1 root  wheel     88136 Apr 21 19:45 boot
-rwx------   1 root  wheel  22992197 Aug 25 13:50 bsd
-rwx------   1 root  wheel  22980141 Aug 25 13:27 bsd.booted
-rw-------   1 root  wheel   4606368 Apr 21 19:43 bsd.rd
-rw-------   1 root  wheel  22876084 Apr 21 19:43 bsd.sp
lrwxrwx---   1 root  wheel        11 Apr 12 08:45 sys -> usr/src/sys

But I can see all these bsd.* which are taking a lot of space inside the directory

Any idea about them?

Last edited by J65nko; 9th September 2022 at 06:56 PM. Reason: Added [code] and [/code] tags
Reply With Quote
  #5   (View Single Post)  
Old 9th September 2022
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,983
Default

Take a look in your /dev directory. A very common cause of filling up your root partition is through a typo while running dd(1) as root. All you need to do is mistype an output device name, and suddenly the root partition is full.

The command $ find /dev -type f -ls should find only the MAKEDEV script and a few empty *.lock files.
Reply With Quote
  #6   (View Single Post)  
Old 9th September 2022
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,131
Default

Quote:
Originally Posted by Woden27 View Post
But I can see all these bsd.* which are taking a lot of space inside the directory
Any idea about them?
The total sum of those file sizes is only about 70 MB.

Code:
# awk -f file-size.awk root-files                                
              .cshrc :                  578
            .profile :                  468
                boot :                88136
                 bsd :             22992197
          bsd.booted :             22980141
              bsd.rd :              4606368
              bsd.sp :             22876084
                 sys :                   11
==================== : ====================
         Total bytes :             73543983

$ echo 'scale = 2; 73543983 / 1024^2' | bc
70.13
So these 70 MBs are not the cause of filling up your 600 MB file system.

You have to run # ls -l / | grep '^d' to see the size of the sub-directories in the "/" directory.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #7   (View Single Post)  
Old 14th September 2022
Woden27 Woden27 is offline
Port Guard
 
Join Date: May 2022
Posts: 12
Default

Quote:
Originally Posted by jggimi View Post
Take a look in your /dev directory. A very common cause of filling up your root partition is through a typo while running dd(1) as root. All you need to do is mistype an output device name, and suddenly the root partition is full.

The command $ find /dev -type f -ls should find only the MAKEDEV script and a few empty *.lock files.
Code:
BSD_Network_test# find /dev -type f -ls
 39683   24 -r-xr-xr-x    1 root     wheel       12142 Apr 12 08:45 /dev/MAKEDEV
 40994    0 -rw-------    1 root     wheel           0 Aug 25 13:49 /dev/slaacd.lock
 40996    0 -rw-------    1 root     wheel           0 Aug 25 13:49 /dev/dhcpleased.lock
 40998    0 -rw-------    1 root     wheel           0 Aug 25 13:49 /dev/resolvd.lock
Reply With Quote
  #8   (View Single Post)  
Old 14th September 2022
Woden27 Woden27 is offline
Port Guard
 
Join Date: May 2022
Posts: 12
Default

Quote:
Originally Posted by J65nko View Post
The total sum of those file sizes is only about 70 MB.

Code:
# awk -f file-size.awk root-files                                
              .cshrc :                  578
            .profile :                  468
                boot :                88136
                 bsd :             22992197
          bsd.booted :             22980141
              bsd.rd :              4606368
              bsd.sp :             22876084
                 sys :                   11
==================== : ====================
         Total bytes :             73543983

$ echo 'scale = 2; 73543983 / 1024^2' | bc
70.13
So these 70 MBs are not the cause of filling up your 600 MB file system.

You have to run # ls -l / | grep '^d' to see the size of the sub-directories in the "/" directory.


Code:
BSD_Network_test# ls -lah / | grep '^d'
drwxr-xr-x  13 root  wheel   512B Aug 25 13:50 .
drwxr-xr-x  13 root  wheel   512B Aug 25 13:50 ..
drwxr-xr-x   2 root  wheel   512B Apr 12 08:45 altroot
drwxr-xr-x   2 root  wheel   1.0K Apr 12 08:46 bin
drwxr-xr-x   6 root  wheel  19.0K Aug 25 13:49 dev
drwxr-xr-x  27 root  wheel   2.0K Jun 24 01:30 etc
drwxr-xr-x   3 root  wheel   512B Apr 21 19:45 home
drwxr-xr-x   2 root  wheel   512B Apr 12 08:45 mnt
drwx------   7 root  wheel   1.0K Jul 18 13:41 root
drwxr-xr-x   2 root  wheel   1.5K Apr 12 08:46 sbin
drwxrwxrwt   6 root  wheel   512B Sep 15 01:31 tmp
drwxr-xr-x  17 root  wheel   512B May  6 16:48 usr
drwxr-xr-x  24 root  wheel   512B May  4 16:52 var
BSD_Network_test# df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/sd0a      600M    600M  -29.9M   105%    /
/dev/sd0k      3.7G    464M    3.0G    13%    /home
/dev/sd0d      848M   10.0K    806M     0%    /tmp
/dev/sd0f      2.3G    1.8G    386M    83%    /usr
/dev/sd0g      643M    299M    312M    49%    /usr/X11R6
/dev/sd0h      2.3G    453M    1.8G    20%    /usr/local
/dev/sd0j      5.2G    2.0K    4.9G     0%    /usr/obj
/dev/sd0i      1.6G    2.0K    1.5G     0%    /usr/src
/dev/sd0e      1.2G    165M    1.0G    14%    /var
Reply With Quote
  #9   (View Single Post)  
Old 15th September 2022
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,983
Default

The ls(1) command shows the size of the directories, but not the consumption of storage by the files within. Try something like # du -chxd 1 / to get the total size consumed by the files within, and then you may be able to find the directory structure to investigate further. I'm recommending the du(1) disk utilization utility to be used with -c to show the total at the end of the report, with -h to show human-readable output, with -x to only inspect the single root filesystem, and with -d 1 to only go one directory deep. For example, on this laptop, I am consuming 168 MB in the root filesystem, with about 42 MB in /etc configuration files. If there was a directory that I wanted to dig into further, I would run du(1) in that directory, looking for the cause of the problem.
Code:
# du -chxd 1 /
2.0K    /altroot
41.9M   /etc
4.0K    /mnt
15.7M   /sbin
2.0K    /usr
5.9M    /bin
40.0K   /dev
4.0K    /home
12.3M   /root
2.0K    /tmp
2.0K    /var
6.0K    /lost+found
2.0K    /.cache
168M    /
168M    total
Reply With Quote
Old 15th September 2022
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,131
Default

This are your different file systems:
Code:
BSD_Network_test# df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/sd0a      600M    600M  -29.9M   105%    /
/dev/sd0k      3.7G    464M    3.0G    13%    /home
/dev/sd0d      848M   10.0K    806M     0%    /tmp
/dev/sd0f      2.3G    1.8G    386M    83%    /usr
/dev/sd0g      643M    299M    312M    49%    /usr/X11R6
/dev/sd0h      2.3G    453M    1.8G    20%    /usr/local
/dev/sd0j      5.2G    2.0K    4.9G     0%    /usr/obj
/dev/sd0i      1.6G    2.0K    1.5G     0%    /usr/src
/dev/sd0e      1.2G    165M    1.0G    14%    /var
The one in red is the problematic, the others in green are not part of "/" on sd0a. But knowing them is key to eliminate them.
Code:
BSD_Network_test# ls -lah / | grep '^d'
drwxr-xr-x  13 root  wheel   512B Aug 25 13:50 .
drwxr-xr-x  13 root  wheel   512B Aug 25 13:50 ..
drwxr-xr-x   2 root  wheel   512B Apr 12 08:45 altroot
drwxr-xr-x   2 root  wheel   1.0K Apr 12 08:46 bin
drwxr-xr-x   6 root  wheel  19.0K Aug 25 13:49 dev
drwxr-xr-x  27 root  wheel   2.0K Jun 24 01:30 etc
drwxr-xr-x   3 root  wheel   512B Apr 21 19:45 home
drwxr-xr-x   2 root  wheel   512B Apr 12 08:45 mnt
drwx------   7 root  wheel   1.0K Jul 18 13:41 root
drwxr-xr-x   2 root  wheel   1.5K Apr 12 08:46 sbin
drwxrwxrwt   6 root  wheel   512B Sep 15 01:31 tmp
drwxr-xr-x  17 root  wheel   512B May  6 16:48 usr
drwxr-xr-x  24 root  wheel   512B May  4 16:52 var
Deleting the "." and ".." and green directories from that listing leaves us with the suspects
Code:
BSD_Network_test# ls -lah / | grep '^d'
drwxr-xr-x   2 root  wheel   512B Apr 12 08:45 altroot
drwxr-xr-x   2 root  wheel   1.0K Apr 12 08:46 bin
drwxr-xr-x   6 root  wheel  19.0K Aug 25 13:49 dev
drwxr-xr-x  27 root  wheel   2.0K Jun 24 01:30 etc
drwxr-xr-x   2 root  wheel   512B Apr 12 08:45 mnt
drwx------   7 root  wheel   1.0K Jul 18 13:41 root
drwxr-xr-x   2 root  wheel   1.5K Apr 12 08:46 sbin
For each of these directories: altroot bin dev etc mnt root sbin
you do :
Code:
# du /altroot/* | sort -rnk1 | less
# du /bin/* |  sort -rnk1 | less

[snip]

# du /root/*  | sort -rnk1 | less
# du /sbin/* | sort -rnk1 | less
EDIT I wrote : "You have to run # ls -l / | grep '^d' to see the size of the sub-directories in the "/" directory." As jggimi pointed out this was an error. It should have been running # du /directory/* | sort -rnk1 | less as written above.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump

Last edited by J65nko; 15th September 2022 at 03:34 AM.
Reply With Quote
Old 19th September 2022
Woden27 Woden27 is offline
Port Guard
 
Join Date: May 2022
Posts: 12
Thumbs up

Quote:
Originally Posted by jggimi View Post
The ls(1) command shows the size of the directories, but not the consumption of storage by the files within. Try something like # du -chxd 1 / to get the total size consumed by the files within, and then you may be able to find the directory structure to investigate further. I'm recommending the du(1) disk utilization utility to be used with -c to show the total at the end of the report, with -h to show human-readable output, with -x to only inspect the single root filesystem, and with -d 1 to only go one directory deep. For example, on this laptop, I am consuming 168 MB in the root filesystem, with about 42 MB in /etc configuration files. If there was a directory that I wanted to dig into further, I would run du(1) in that directory, looking for the cause of the problem.
Code:
# du -chxd 1 /
2.0K    /altroot
41.9M   /etc
4.0K    /mnt
15.7M   /sbin
2.0K    /usr
5.9M    /bin
40.0K   /dev
4.0K    /home
12.3M   /root
2.0K    /tmp
2.0K    /var
6.0K    /lost+found
2.0K    /.cache
168M    /
168M    total

Yup, this did the trick.
I had two huge files inside the /root dir (TCP dump captures)

Thanks!
Reply With Quote
Old 19th September 2022
Woden27 Woden27 is offline
Port Guard
 
Join Date: May 2022
Posts: 12
Default [solved]

[solved]
Reply With Quote
Reply

Tags
du, file system full, filesystem free space, filesystem full


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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
/ is full leave0 OpenBSD General 5 4th August 2022 12:32 PM
filesystem full? amandus FreeBSD General 11 11th June 2013 12:10 PM
/usr became full while updating via cvs IronForge OpenBSD Installation and Upgrading 3 6th January 2010 01:08 PM
/usr is full (OpenBSD 4.5 current) valorisa OpenBSD Packages and Ports 7 10th June 2009 01:28 PM
/ is full, can't installkernel thevirtuesofxen FreeBSD General 4 18th August 2008 06:33 AM


All times are GMT. The time now is 05:01 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick