在我的 Ubuntu 桌面上,该命令fdisk -l
显示 /dev/loopX 最多 /dev/loop23
。我在 Ubuntu 18.04 LTS 上使用 gnome-fallback。
我想知道这些可能会对操作系统的性能和稳定性产生什么影响,如果它们只是多余的,我该如何删除它们?
root@pc5:~# fdisk -l
...
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop15: 3.7 MiB, 3821568 bytes, 7464 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop16: 54.6 MiB, 57274368 bytes, 111864 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop17: 140.7 MiB, 147501056 bytes, 288088 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop18: 14.8 MiB, 15462400 bytes, 30200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop19: 42.8 MiB, 44879872 bytes, 87656 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop20: 54.5 MiB, 57151488 bytes, 111624 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop21: 4.2 MiB, 4403200 bytes, 8600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop22: 153.5 MiB, 160935936 bytes, 314328 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop23: 140.7 MiB, 147501056 bytes, 288088 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
输出df
:
Filesystem 1K-blocks Used Available Use% Mounted on
udev 8128184 0 8128184 0% /dev
tmpfs 1630464 3716 1626748 1% /run
/dev/sda2 229184876 63255488 154217748 30% /
tmpfs 8152300 142672 8009628 2% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 8152300 0 8152300 0% /sys/fs/cgroup
/dev/loop2 160512 160512 0 100% /snap/gnome-3-28-1804/110
/dev/loop3 4352 4352 0 100% /snap/gnome-calculator/544
/dev/loop0 3840 3840 0 100% /snap/gnome-system-monitor/111
/dev/loop4 91264 91264 0 100% /snap/core/8039
/dev/loop1 1024 1024 0 100% /snap/gnome-logs/81
/dev/loop6 87936 87936 0 100% /snap/shotcut/55
/dev/loop5 406528 406528 0 100% /snap/redis-desktop-manager/332
/dev/loop8 91264 91264 0 100% /snap/core/8213
/dev/loop7 406656 406656 0 100% /snap/redis-desktop-manager/335
/dev/loop9 15104 15104 0 100% /snap/gnome-characters/367
/dev/loop11 157184 157184 0 100% /snap/chromium/949
/dev/loop12 87808 87808 0 100% /snap/shotcut/53
/dev/loop13 1024 1024 0 100% /snap/gnome-logs/73
/dev/loop14 45312 45312 0 100% /snap/gtk-common-themes/1353
/dev/loop16 55936 55936 0 100% /snap/core18/1279
/dev/loop15 3840 3840 0 100% /snap/gnome-system-monitor/107
/dev/loop10 159872 159872 0 100% /snap/gnome-3-28-1804/91
/dev/loop17 144128 144128 0 100% /snap/gnome-3-26-1604/97
/dev/sda1 523248 6232 517016 2% /boot/efi
/dev/loop18 15104 15104 0 100% /snap/gnome-characters/359
/dev/loop19 43904 43904 0 100% /snap/gtk-common-themes/1313
/dev/loop20 55936 55936 0 100% /snap/core18/1265
/dev/loop21 4352 4352 0 100% /snap/gnome-calculator/536
/dev/loop22 157184 157184 0 100% /snap/chromium/958
/dev/loop23 144128 144128 0 100% /snap/gnome-3-26-1604/98
/dev/sdb1 492127240 409174612 57930932 88% /home
tmpfs 1630460 16 1630444 1% /run/user/121
tmpfs 1630460 140 1630320 1% /run/user/1001
tmpfs 1630460 0 1630460 0% /run/user/0
答案1
编辑sudo fdisk -l
今天问题已经改了,所以这里介绍一下如何删除多余的输出,而不需要删除所有的快照,也不需要留下计算器等等:
sudo fdisk -l | sed -e '/Disk \/dev\/loop/,+5d'
由于这可能很难记住,您可以在中创建一个别名~/.bashrc
:
alias fdsk="sudo fdisk -l | sed -e '/Disk \/dev\/loop/,+5d'"
然后只需fdsk
在命令行中输入并在提示时输入您的密码。
正如评论中所提到的,/dev/loop99
这里描述了快照文件系统图像:
假设你不想卸载所有 snap 包,那么下一个最佳选择就是通过附加 来隐藏它们| grep -v ^/dev/loop
。例如:
$ df | grep -v ^/dev/loop
Filesystem 1K-blocks Used Available Use% Mounted on
udev 3978476 0 3978476 0% /dev
tmpfs 802400 1688 800712 1% /run
/dev/nvme0n1p6 46445360 33133368 11159560 75% /
tmpfs 4011984 227448 3784536 6% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 4011984 0 4011984 0% /sys/fs/cgroup
/dev/nvme0n1p8 9485308 1890272 7595036 20% /mnt/e
/dev/nvme0n1p10 27937812 22501880 3993732 85% /mnt/clone
/dev/nvme0n1p7 23734708 19316220 3189796 86% /mnt/old
/dev/nvme0n1p4 380829660 169799196 211030464 45% /mnt/c
/dev/nvme0n1p2 97280 33222 64058 35% /boot/efi
/dev/sda3 963668988 43929712 919739276 5% /mnt/d
tmpfs 802400 60 802340 1% /run/user/1000
答案2
所有环路安装的设备似乎快照。如果(正如您所指出的)您确实不想让其中任何一个提及man snap
。
以下是相关摘录:
remove
Remove snaps from the system
The remove command removes the named snap instance from the system.
By default all the snap revisions are removed, including their data and the common data direc‐
tory. When a --revision option is passed only the specified revision is removed.
Usage: snap remove [remove-OPTIONS]
--no-wait
Do not wait for the operation to finish but just print the change id.
--revision
Remove only the given revision
--purge
Remove the snap without saving a snapshot of its data
举个例子:
snap remove --purge gphoto2
正如手册页中提到的--purge
开关会删除快照而不保存其数据的快照。如此评论您可能希望找到这些 snap 应用程序的非 snap 替代品。
Ubuntu 软件包搜索页面可能有助于您搜索具有相应功能的 deb 包。
注意力:正如所提到的这个答案虽然您可以卸载目录并删除核心快照,但这样做会破坏所有已安装的快照,因此系统会使您很难做到这一点。
顺便说一句,重要的是要明白 snap 软件包的优点和缺点是一样的,而且围绕这些软件包的批评和赞誉也是一样的。根据你问的人的不同,snap 自动更新既有人讨厌,也有人喜欢。只读循环安装的 snap 对某些人来说是一种福音,对另一些人来说却是一种烦恼。你可以在以下网址了解更多信息:https://en.wikipedia.org/wiki/Snappy_(package_manager)
维基百科文章中引用的许多文章也值得一读。