Ao tentar solucionar problemas de uma máquina que está ficando sem memória e travando bastante: O que eu faço sobre uma máquina que está ficando sem memória e travando?
Eu descobri que, embora haja uma partição Swap em /dev/sda8
:
Disk /dev/sda: 238.5 GiB, 256060514304 bytes, 500118192 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
Disklabel type: gpt
Disk identifier: 9A31978F-5B21-44F6-BF08-34F2D2AD62B6
Device Start End Sectors Size Type
/dev/sda1 2048 2050047 2048000 1000M Windows recovery environment
/dev/sda2 2050048 2582527 532480 260M EFI System
/dev/sda3 2582528 2844671 262144 128M Microsoft reserved
/dev/sda4 2846720 256557055 253710336 121G Linux filesystem
/dev/sda5 457578496 485437439 27858944 13.3G Windows recovery environment
/dev/sda6 485437440 500117503 14680064 7G Intel Fast Flash
/dev/sda7 256557056 441047039 184489984 88G Linux filesystem
/dev/sda8 441047040 457578495 16531456 7.9G Linux swap
Embora esteja lá, não está sendo usado.
total used free shared buff/cache available
Mem: 7.7G 3.9G 1.8G 1.3G 2.0G 2.2G
Swap: 0B 0B 0B
Parece que foi comentado em fstab
:
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda7 during installation
UUID=1c458890-63a1-4c38-befa-66148cb6f8c2 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda2 during installation
UUID=F232-FC61 /boot/efi vfat defaults 0 1
# swap was on /dev/sda8 during installation
#UUID=968be4fc-0850-471c-b6f8-21ecb10626dc none swap sw 0 0
#/dev/mapper/cryptswap1 none swap sw 0 0
/dev/disk/by-uuid/2C883E19883DE1CE /mnt/2C883E19883DE1CE auto nosuid,nodev,nofail,x-gvfs-show 0 0
/dev/disk/by-uuid/32033d20-8c17-48f4-b014-6f581099441b /media/misc auto nosuid,nodev,nofail,x-gvfs-show 0 0
Mas nem tenho certeza se esse é o uuid correto, porque /dev/sda8
não aparece em ls -lha /dev/disk/by-uuid/
:
amanda@Flatbush:~$ ls -lha /dev/disk/by-uuid/
total 0
drwxr-xr-x 2 root root 140 Mar 10 19:08 .
drwxr-xr-x 8 root root 160 Mar 10 19:08 ..
lrwxrwxrwx 1 root root 10 Mar 10 19:08 1c458890-63a1-4c38-befa-66148cb6f8c2 -> ../../sda7
lrwxrwxrwx 1 root root 10 Mar 10 19:08 32033d20-8c17-48f4-b014-6f581099441b -> ../../sda4
lrwxrwxrwx 1 root root 10 Mar 10 19:08 76B631A3B63164B1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Mar 10 19:08 8E9A2F109A2EF3FD -> ../../sda5
lrwxrwxrwx 1 root root 10 Mar 10 19:08 F232-FC61 -> ../../sda2
blkid
mostra um UUID diferente de /etc/fstab
:
amanda@Flatbush:~$ sudo blkid
/dev/sda1: LABEL="WINRE_DRV" UUID="76B631A3B63164B1" TYPE="ntfs" PARTUUID="8df271fe-b011-4817-99d6-a73603990fed"
/dev/sda2: LABEL="SYSTEM_DRV" UUID="F232-FC61" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="e022f5a1-9ef4-470b-b245-fc3f808e990a"
/dev/sda4: UUID="32033d20-8c17-48f4-b014-6f581099441b" TYPE="ext4" PARTLABEL="Media" PARTUUID="5561a792-93fe-41ca-b8ce-decf065bcae2"
/dev/sda5: LABEL="Lenovo_Recovery" UUID="8E9A2F109A2EF3FD" TYPE="ntfs" PARTUUID="120ea024-5d62-414f-86e7-20b4dc584b58"
/dev/sda7: UUID="1c458890-63a1-4c38-befa-66148cb6f8c2" TYPE="ext4" PARTUUID="f86d11cd-ae91-49af-b93e-944e3da180cc"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"
/dev/loop4: TYPE="squashfs"
/dev/loop5: TYPE="squashfs"
/dev/loop6: TYPE="squashfs"
/dev/loop7: TYPE="squashfs"
/dev/sda3: PARTLABEL="Microsoft reserved partition" PARTUUID="7a7bbfd5-6b38-4a5c-9c9e-dc9b9dd2a601"
/dev/sda6: PARTLABEL="Basic data partition" PARTUUID="9e10a03b-af15-4ee1-a14f-95c570100a40"
/dev/sda8: PARTUUID="401fbf68-8440-4f27-9337-9f11689a705b"
/dev/loop8: TYPE="squashfs"
/dev/loop9: TYPE="squashfs"
/dev/loop10: TYPE="squashfs"
/dev/loop11: TYPE="squashfs"
...
e e2fsck
diz que há um "número mágico ruim":
amanda@Flatbush:~$ sudo e2fsck /dev/sda8
e2fsck 1.44.1 (24-Mar-2018)
ext2fs_open2: Bad magic number in super-block
e2fsck: Superblock invalid, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/sda8
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
or
e2fsck -b 32768 <device>
Diante de tudo isso, qual é o caminho certo ™ para obter uma partição swap nesta máquina. Executando 18.04.2.
PS. Não acho que isso importe aqui, mas quando construí originalmente a máquina, pensei que havia uma chance de ele odiar rodar o Linux, então deixei a partição de recuperação do Windows. Ele estava bem com o Linux até que começou a sufocar.
Não posso prometer que fiz do jeito certo ™, mas eu...
/etc/fstab
esudo swapon
Mesmo após uma reinicialização,
free -h
mostra 7,9 G de troca total. Então isso parece ter funcionado. Infelizmente, ainda não tenho ideia de como isso engasgou, mas acho que você não pode saber tudo.