Shrink or delete udev partition in Ubuntu?
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.
- 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?
- If I repartition, do I delete udev or just shrink it?
Solution 1:
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
- 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 thetmpfs
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. - 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.