Shrink or delete udev partition in Ubuntu?

10

2

I ran out of disk space today while trying to compile a program. When I ran df -h, I noticed that the partitions were wonky. df -h yields

Filesystem      Size  Used Avail Use% Mounted on 
/dev/sda1       4.6G  4.4G     0 100% /
udev             32G  4.0K   32G   1% /dev
tmpfs            13G  724K   13G   1% /run 
none            5.0M     0  5.0M   0% /run/lock
none             32G     0   32G   0% /run/shm

I've got a few questions about this output.

  1. Why is all of the space assigned to udev? Was it just a mistake that the user made during installation or is there a reason for this?
  2. If I repartition, do I delete udev or just shrink it?

Sean Egan

Posted 2013-11-13T19:53:40.727

Reputation: 128

You cannot shrink /dev partition, it is a VFS which resides wholly in memory, like tmpfsa – MariusMatutiae – 2013-11-13T22:04:24.337

So is that just unused disk space? Can I just increase the partition size of /dev/sda1 to access the unused storage? – Sean Egan – 2013-11-13T23:44:02.353

Answers

14

udev is not a partition on a permanent hard drive. It is a RAM disk. As such it does not consume any capacity of a permanent hard drive (except part of swap when the system is short on RAM).

RAM disks and /dev in Linux

Ubuntu as many modern Linux distributions uses devtmpfs file system for the /dev directory. The directory contain special (device) files which are just interfaces to device drivers. devtmpfs is a just special instance of tmpfs. The /dev directory is an essential part of the Unix-like directory structure. If you delete it the system will stop functioning.

You can notice that in Ubuntu tmpfs is also being mounted on /run and its subdirectories. On some other systems it could also be mount at /tmp.

Your questions

  1. The space assignment is the default setting. By default tmpfs file systems are limited to 50 % of your RAM capacity. (Do you have 64 GB of RAM?) The number is really just a limit because the tmpfs file systems do occupy only the space which is needed to store the files and for the /dev directory the required space is very small. The occupied capacity in your (an my) case is few KB.
  2. You cannot influence the tmpfs sizes by partitioning because they are not stored on physical drives. Removing it is not possible at all without substantial changes to the system. You can make the size limit lower: sudo mount -o remount,size=1G /dev but this will only change the limit but not the actual occupied RAM space.

Solution to your problem

Your solution is to repartition the drive and make /dev/sda1 larger (easier if repartitioning is possible) or to add new partitions and, mount them to the appropriate directories and move the existing files there to free the root (/) file system.

pabouk

Posted 2013-11-13T19:53:40.727

Reputation: 5 358

1Thanks so much! I do have 64 GB of RAM, but I also have 72 GB of hard drive space. So I was thinking that maybe the 64 GB was unallocated space. This really cleared it up for me! I'll just use fdisk to increase /dev/sda1. – Sean Egan – 2013-11-14T00:28:10.960