Is is safe to get rid of /dev/loop* files

What I’ve Tried:
I’m not sure if it’s safe to try anything before getting an aswer

I apologize for no information in the first post but I couldn’t figure out how to post any info until I created the post & then replied to it.

I’m a litlle familiar with the idea that the loops are connected to snap but I have no idea if it’s safe to delete them. It’s rather frustrating using fdisk -l & seeing all these loops that just make no sense to me. I’m not sure I’ve ever installed a program using snap but if I did does that mean those loops are necessary?

/dev/loop files are needed by snap, if you remove it you remove also related snap.

with lsblk -o name,label,size,fstype,mountpoint

you will see the name of the related snap app .

2 Likes

Test these command to see if they provide the information more concisely:-

sudo fdisk -l | sed -e '/Disk \/dev\/loop/,+5d'
sudo parted -l
lsblk -e 7
1 Like

man page - loop might help understand what a loop device is. My opinion: Better not touch loop devices you didn’t create yourself.

1 Like

Thanks, I guess I’ll leave things alone.

Before you gave me all those other options, the only way I coud read things was using :

lsblk | grep -v “loop”

I’m not sure what you are trying to accomplish but if you just want fdisk output without all the loops, use the command suggested above by tea for one.

2 Likes

I’ve just edited & hidden the support template text that was unaltered.

I feared it was distracting/unhelpful for readers of this thread, thus it’s been commented out.

1 Like

side note:

This works on systems set to english. For international use:

LANG=C sudo fdisk -l | sed -e '/Disk /dev/loop/,+5d'

or just

sudo fdisk -l | sed -e '/ /dev/loop/,+5d'

1 Like

Just to be clear about the main reason I posted this question was mainly to know whether or not all those loop files were necessary & if deleting any of them could cause any problems.

I’ve been using the fdisk terminal command for around twenty years & the loop files never showed up for most of those years. I can’t remember what version they started with but my guess is somewhere in the 2020s. It was annoying running the command & I was wondering if they were just creating more bloat in my system than was needed. I also appreciate the sed work arounds that have been given in this thread to make things less annoying. I do want to thank everyone for the help.

1 Like