You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org

User:Razzi/learning storage on vagrant

From Wikitech-static
< User:Razzi
Revision as of 22:16, 21 April 2021 by imported>Razzi
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

vagrant init debian/buster64

vagrant@buster:~$ lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0 19.8G  0 disk
├─sda1   8:1    0 18.8G  0 part /
├─sda2   8:2    0    1K  0 part
└─sda5   8:5    0 1021M  0 part [SWAP]

Let's remove the swap

vagrant@buster:~$ sudo swapoff /dev/sda5
vagrant@buster:~$ lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0 19.8G  0 disk
├─sda1   8:1    0 18.8G  0 part /
├─sda2   8:2    0    1K  0 part
└─sda5   8:5    0 1021M  0 part

Now does it go away persistently?

vagrant@buster:~$ sudo mount
...

vagrant@buster:~$ lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0 19.8G  0 disk
├─sda1   8:1    0 18.8G  0 part /
├─sda2   8:2    0    1K  0 part
└─sda5   8:5    0 1021M  0 part

Looks like it went away, but then rebooting makes it come back.

Apparently mount -a is how to apply /etc/fstab:

vagrant@buster:~$ cat /etc/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/vda1 during installation
UUID=983742b1-65a8-49d1-a148-a3865ea09e24 /               ext4    errors=remount-ro 0       1
# swap was on /dev/vda5 during installation
UUID=04559374-06db-46f1-aa31-e7a4e6ec3286 none            swap    sw              0       0
/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0

But swap doesn't come back even when doing this.

vagrant@buster:~$ sudo mount -a
vagrant@buster:~$ lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0 19.8G  0 disk
├─sda1   8:1    0 18.8G  0 part /
├─sda2   8:2    0    1K  0 part
└─sda5   8:5    0 1021M  0 part

Can do this in verbose mode:

vagrant@buster:~$ sudo mount -av
/                        : ignored
none                     : ignored
/media/cdrom0            : ignored

Ok, so nothing happened. That second line is the key: nothing to mount, I guess. Swapon has an option for this


      swapon, swapoff - enable/disable devices and files for paging and swapping
SYNOPSIS
      swapon [options] [specialfile...]
      swapoff [-va] [specialfile...]
OPTIONS
      -a, --all
             All devices marked as ``swap in /etc/fstab are made available, except for those with  the  ``noauto  option.
             Devices that are already being used as swap are silently skipped.
vagrant@buster:~$ sudo swapon -a
vagrant@buster:~$ lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0 19.8G  0 disk
├─sda1   8:1    0 18.8G  0 part /
├─sda2   8:2    0    1K  0 part
└─sda5   8:5    0 1021M  0 part [SWAP]

Let's take it a step further and remove the swap partition entirely.

Doing some searching, I see how to do this with fdisk... I'm reluctant since it's interactive but I might as well get used to it.

sudo fdisk /dev/sda5

Seems promising, but perhaps I want to edit /dev/sda to remove sda5.


https://www.xmodulo.com/how-to-run-fdisk-in-non-interactive-batch-mode.html