LINUX.ORG.RU

[SOLVED] Как удалить /dev/zram* ?

 , , , ,


0

1

В свое время я настроил на CentOS 8 у себя zram по рецепту с ArchWiki: https://wiki.archlinux.org/index.php/Improving_performance#Swap_on_zRAM_using...

Это сработало, но потом я решил перейти на swap-file. Поэтому я удалил все файлы

/etc/modules-load.d/zram.conf
/etc/modprobe.d/zram.conf
/etc/udev/rules.d/99-zram.rules
и вычистил /etc/fstab от записей с zram, после чего выполнил
systemctl daemon-reload

Но при загрузке эти 4 zram продолжают создаваться.

[root@localhost ~]# journalctl | grep zram
May 19 10:23:04 localhost.localdomain kernel: zram: Added device: zram0
May 19 10:23:04 localhost.localdomain kernel: zram: Added device: zram1
May 19 10:23:04 localhost.localdomain kernel: zram: Added device: zram2
May 19 10:23:04 localhost.localdomain kernel: zram: Added device: zram3
May 19 10:23:04 localhost.localdomain systemd-modules-load[286]: Inserted module 'zram'
May 19 10:23:12 localhost.localdomain systemd[1]: sys-devices-virtual-block-zram0.device: Failed to enqueue SYSTEMD_WANTS= job, ignoring: Unit zram-setup@zram0.service not found.
May 19 10:23:12 localhost.localdomain systemd[1]: sys-devices-virtual-block-zram3.device: Failed to enqueue SYSTEMD_WANTS= job, ignoring: Unit zram-setup@zram3.service not found.
May 19 10:23:12 localhost.localdomain systemd[1]: sys-devices-virtual-block-zram1.device: Failed to enqueue SYSTEMD_WANTS= job, ignoring: Unit zram-setup@zram1.service not found.
May 19 10:23:12 localhost.localdomain systemd[1]: sys-devices-virtual-block-zram2.device: Failed to enqueue SYSTEMD_WANTS= job, ignoring: Unit zram-setup@zram2.service not found.
[root@localhost ~]# systemctl list-units --type device --all | grep zram
dev-zram0.device                                                                         loaded active plugged /dev/zram0                                                                
dev-zram1.device                                                                         loaded active plugged /dev/zram1                                                                
dev-zram2.device                                                                         loaded active plugged /dev/zram2                                                                
dev-zram3.device                                                                         loaded active plugged /dev/zram3                                                                
sys-devices-virtual-block-zram0.device                                                   loaded active plugged /sys/devices/virtual/block/zram0                                          
sys-devices-virtual-block-zram1.device                                                   loaded active plugged /sys/devices/virtual/block/zram1                                          
sys-devices-virtual-block-zram2.device                                                   loaded active plugged /sys/devices/virtual/block/zram2                                          
sys-devices-virtual-block-zram3.device                                                   loaded active plugged /sys/devices/virtual/block/zram3                                      
[root@localhost ~]# ls -la /dev | grep zram
brw-rw----.  1 root     disk      253,   0 May 19 10:23 zram0
brw-rw----.  1 root     disk      253,   1 May 19 10:23 zram1
brw-rw----.  1 root     disk      253,   2 May 19 10:23 zram2
brw-rw----.  1 root     disk      253,   3 May 19 10:23 zram3

Как правильно вычистить остатки zram из системы?

Ответ на: комментарий от ChekPuk
[root@localhost ~]# systemctl list-units --type swap --all
UNIT          LOAD   ACTIVE SUB    DESCRIPTION                                                                                                                                          
swapfile.swap loaded active active /swapfile                                                                                                                                            

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

1 loaded units listed.
To show all installed unit files use 'systemctl list-unit-files'.
Vsevolod-linuxoid ★★★★★ ()
Ответ на: комментарий от ChekPuk
[root@localhost ~]# systemctl list-unit-files | grep zram
zram.service                                                           static   
[root@localhost ~]# cat /usr/lib/systemd/system/zram.service
[Unit]
Description=Service enabling compressing RAM with zRam
ConditionKernelCommandLine=!inst.zram=off
ConditionKernelCommandLine=!inst.zram=0

[Service]
Type=oneshot
ExecStart=/usr/libexec/anaconda/zramswapon
ExecStop=/usr/libexec/anaconda/zramswapoff
RemainAfterExit=yes

Vsevolod-linuxoid ★★★★★ ()
Ответ на: комментарий от anonymous

Спасибо, это сработало. Решил всё 4 командами:

cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).bak.$(date +%m-%d-%H%M%S).img
dracut -f -v
grub2-mkconfig -o /boot/grub2/grub.cfg
reboot
[root@localhost ~]# journalctl | grep zram
[root@localhost ~]# systemctl list-units --type device --all | grep zram
[root@localhost ~]# ls -la /dev | grep zram
[root@localhost ~]# 
Vsevolod-linuxoid ★★★★★ ()
Последнее исправление: Vsevolod-linuxoid (всего исправлений: 2)