Glabel, gpart, geom, or How to label GPT, GPTID partitions with out a /dev/da1p3 drive name.
First, can you read between the lines from a manual pages that INFER a similar naming/numbering scheme exists that you can try out, yet there is not ONE example to guide you. EXAMPLE:
mount -t zfs /dev/da1p2 /mnt/bsd
gpart show
=> 34 468877245 ada0 GPT (224G)
34 4062 - free - (2.0M)
4096 614400 1 efi (300M)
618496 449799648 2 linux-data (214G)
450418144 7 - free - (3.5K)
450418151 18454920 3 freebsd-swap (8.8G)
468873071 4208 - free - (2.1M)
=> 40 468862048 diskid/DISK-333457EBD0F2 GPT (224G)
40 532480 1 efi (260M)
532520 459218944 2 freebsd-zfs (219G)
459751464 9099264 3 freebsd-swap (4.3G)
468850728 11360
gpart status
Name Status Components
ada0p1 OK ada0
ada0p2 OK ada0
ada0p3 OK ada0
diskid/DISK-333457EBD0F2p1 OK diskid/DISK-333457EBD0F2
diskid/DISK-333457EBD0F2p2 OK diskid/DISK-333457EBD0F2
diskid/DISK-333457EBD0F2p3 OK diskid/DISK-333457EBD0F2
gpart show -l
=> 34 468877245 ada0 GPT (224G)
34 4062 - free - (2.0M)
4096 614400 1 (null) (300M)
618496 449799648 2 (null) (214G)
450418144 7 - free - (3.5K)
450418151 18454920 3 swap-internal-disk (8.8G)
468873071 4208 - free - (2.1M)
=> 40 468862048 diskid/DISK-333457EBD0F2 GPT (224G)
40 532480 1 (null) (260M)
532520 459218944 2 (null) (219G)
459751464 9099264 3 (null) (4.3G)
468850728 11360 - free - (5.5M)
Some of these label names are carried over from the 'file label' name and not the given 'glabel' name in the listings above.
Use a GPT /dev/diskid name to select the "drive" not /dev/da1p2
sudo glabel label -v swap_unirex_244g /dev/diskid/DISK-333457EBD0F2p3
Metadata value stored on /dev/diskid/DISK-333457EBD0F2p3.
Done.
sudo swapctl -A
swapctl: adding /dev/gpt/swap-unirex-224 as swap device
whoami
fred
# use sudo to execute privileged root commands
glabel label -v swap_unirex_244g /dev/diskid/DISK-333457EBD0F2p3
glabel label -v bootfs_unirex_244g /dev/diskid/DISK-333457EBD0F2p1
## The next one only works when the filesystem unmounted! and NOT in USE
umount /dev/diskid/DISK-333457EBD0F2p2
mkdir /mnt/bsdp2
glabel label -v rootfs_unirex_244g /dev/diskid/DISK-333457EBD0F2p2
mount -t zfs /dev/diskid/DISK-333457EBD0F2p2 /mnt/DISK-333457EBD0F2p2
/etc/fstab
fred@fred-pc ~> cat /etc/fstab
# Device Mountpoint FStype OptionsDump Pass
# diskid/DISK-333457EBD0F2p3 801fd8c2-7926-11ec-b6e6-0021ccd45dec
# /dev/gptid/801fd8c2-7926-11ec-b6e6-0021ccd45dec
# /dev/label/swap0 none swap sw 0 0
# /dev/label/swap-unirex-224 none swap sw 0 0
/dev/gpt/swap-unirex-224 none swap sw 0 0
procfs /proc procfs rw 00
linprocfs /compat/linux/proc linprocfs rw 00
tmpfs /compat/linux/dev/shm tmpfs rw,mode=1777 0 0
linsysfs /compat/linux/sys linsysfs rw 0 0
fdesc /dev/fd fdescfs rw 0 0
fred@fred-pc ~>
I get confused about which label goes with which partition. So here are commands to use for finding information.
gpart status
gpart show
gpart show -l
gpart list
glabel list
# use the following command to see what labels are used with which devices.
ls -l /dev/gpt /dev/gptid /dev/diskid /dev/label
# URL links to more information about glabel and gpart commands
glabel label -v rootfs_unirex_244g /dev/diskid/DISK-333457EBD0F2p2
So the answer is to Glabel your GPT UUID external USB 3.0 SSD drive, Next use that as the first or 2nd line in the /etc/fstab file to name your SWAP Partition
/dev/label/swap-unirex-224 none swap sw 0 0
/dev/gpt/swap-unirex-224 none swap sw 0 0
swapon -aL to turn the swap on for all swap partitions listed in the file /etc/fstab
swapinfo -m will tell you how much of your swap space is used in megabytes.
swapinfo -m
Device 1M-blocks Used Avail Capacity
/dev/gpt/swap-unirex-224 4443 578 3864 13%
swapinfo -h in Human readable sizes
swapinfo -h
Device Size Used Avail Capacity
/dev/gpt/swap-unirex-224 4.3G 578M 3.8G 13%
Tools to check Free Memory available and How much SWAP memory is used
freecolor -t Is another useful tool that prints on the command line in colors red,grey, and green, a fuel gauge style examples: freecolor -o ; freecolor -om; freecolor -mt
swapctl -l Is another method to display your swap space memory usage
free
freebsd-memory.sh
whereis free
free: /usr/local/bin/free
ls -l /usr/local/bin/fr*
-rwxr-xr-x 1 fred fred 6756 Jan 21 22:00 /usr/local/bin/free
-rwxr-xr-x 1 fred fred 5461 Jan 21 22:01 /usr/local/bin/freebsd-memory.sh
-rwxr-xr-x 1 root wheel 11008 Apr 29 06:21 /usr/local/bin/freecolor
-rwxr-xr-x 1 root wheel 22280 Apr 28 11:33 /usr/local/bin/fribidi
-r-xr-xr-x 1 root wheel 269 Apr 28 11:33 /usr/local/bin/fribidi-config
whereis freecolor
freecolor: /usr/local/bin/freecolor /usr/local/man/man1/freecolor.1.gz /usr/ports/sysutils/freecolor
fred@fred-pc ~> ls -l /dev/gpt /dev/gptid /dev/diskid /dev/label
ls: /dev/label: No such file or directory
/dev/diskid:
total 0
crw-r----- 1 root operator 0xa2 Jan 29 14:36 DISK-333457EBD0F2
crw-r----- 1 root operator 0xa8 Jan 29 14:36 DISK-333457EBD0F2p1
crw-r----- 1 root operator 0xa9 Jan 29 14:36 DISK-333457EBD0F2p2
crw-r----- 1 root operator 0xae Jan 29 14:36 DISK-333457EBD0F2p3
/dev/gpt:
total 0
crw-r----- 1 root operator 0x95 Jan 29 14:36 swap-internal-disk
/dev/gptid:
total 0
crw-r----- 1 root operator 0x97 Jan 29 14:36 873d142e-6117-de4f-bd8c-3075b666793f
crw-r----- 1 root operator 0x91 Jan 29 14:36 d53c24c9-8a7e-7b44-97f0-97311087d9fa
glabel list
Geom name: ada0p1
Providers:
1. Name: gptid/d53c24c9-8a7e-7b44-97f0-97311087d9fa
Mediasize: 314572800 (300M)
Sectorsize: 512
Stripesize: 0
Stripeoffset: 2097152
Mode: r0w0e0
secoffset: 0
offset: 0
seclength: 614400
length: 314572800
index: 0
Consumers:
1. Name: ada0p1
Mediasize: 314572800 (300M)
Sectorsize: 512
Stripesize: 0
Stripeoffset: 2097152
Mode: r0w0e0
Geom name: ada0p3
Providers:
1. Name: gpt/swap-internal-disk
Mediasize: 9448919040 (8.8G)
Sectorsize: 512
Stripesize: 0
Stripeoffset: 230614093312
Mode: r0w0e0
secoffset: 0
offset: 0
seclength: 18454920
length: 9448919040
index: 0
Consumers:
1. Name: ada0p3
Mediasize: 9448919040 (8.8G)
Sectorsize: 512
Stripesize: 0
Stripeoffset: 230614093312
Mode: r0w0e0
Geom name: ada0p3
Providers:
1. Name: gptid/873d142e-6117-de4f-bd8c-3075b666793f
Mediasize: 9448919040 (8.8G)
Sectorsize: 512
Stripesize: 0
Stripeoffset: 230614093312
Mode: r0w0e0
secoffset: 0
offset: 0
seclength: 18454920
length: 9448919040
index: 0
Consumers:
1. Name: ada0p3
Mediasize: 9448919040 (8.8G)
Sectorsize: 512
Stripesize: 0
Stripeoffset: 230614093312
Mode: r0w0e0
Geom name: da0
Providers:
1. Name: diskid/DISK-333457EBD0F2
Mediasize: 240057409536 (224G)
Sectorsize: 512
Stripesize: 4096
Stripeoffset: 0
Mode: r1w1e2
secoffset: 0
offset: 0
seclength: 468862128
length: 240057409536
index: 0
Consumers:
1. Name: da0
Mediasize: 240057409536 (224G)
Sectorsize: 512
Stripesize: 4096
Stripeoffset: 0
Mode: r1w1e3
Geom name: cd0
Providers:
1. Name: iso9660/PC_GHS
Mediasize: 100734976 (96M)
Sectorsize: 2048
Mode: r0w0e0
secoffset: 0
offset: 0
seclength: 196748
length: 100734976
index: 0
Consumers:
1. Name: cd0
Mediasize: 100734976 (96M)
Sectorsize: 2048
Mode: r0w0e0
glabel label -v swap-unirex-224G /dev/diskid/DISK-333457EBD0F2p3
glabel: Can't store metadata on /dev/diskid/DISK-333457EBD0F2p3: Permission denied.
fred@fred-pc ~ [1]> sudo glabel label -v swap-unirex-224G /dev/diskid/DISK-333457EBD0F2p3
Password:
Metadata value stored on /dev/diskid/DISK-333457EBD0F2p3.
Done.
sudo glabel label -v bootfs-unirex-224G /dev/diskid/DISK-333457EBD0F2p1
Metadata value stored on /dev/diskid/DISK-333457EBD0F2p1.
Done.
gpart show -l
=> 34 468877245 ada0 GPT (224G)
34 4062 - free - (2.0M)
4096 614400 1 (null) (300M)
618496 449799648 2 (null) (214G)
450418144 7 - free - (3.5K)
450418151 18454920 3 swap-internal-disk (8.8G)
468873071 4208 - free - (2.1M)
=> 40 468862048 diskid/DISK-333457EBD0F2 GPT (224G)
40 532480 1 (null) (260M)
532520 459218944 2 (null) (219G)
459751464 9099264 3 (null) (4.3G)
468850728 11360 - free - (5.5M)
fred@fred-pc ~ [1]> sudo mount -t fat32 /dev/diskid/DISK-333457EBD0F2p1 /mnt/bsd_fat32
mount: /dev/diskid/DISK-333457EBD0F2p1: Operation not supported by device
fred@fred-pc ~ [1]> ls /dev/glabel
ls: /dev/glabel: No such file or directory
fred@fred-pc ~ [1]> ls /dev/label
bootfs-unirex-2 swap-unirex-224
fred@fred-pc ~> ls -l /dev/label
total 0
crw-r----- 1 root operator 0x1ff Jan 30 00:21 bootfs-unirex-2
crw-r----- 1 root operator 0x1fc Jan 30 00:21 swap-unirex-224
fred@fred-pc ~> sudo mount -t fat32 /dev/label/bootfs-unirex-2 /mnt/bsd_fat32
mount: /dev/label/bootfs-unirex-2: Operation not supported by device
fred@fred-pc ~ [1]> sudo mount -t fat32 /dev/label/bootfs-unirex-2224g /mnt/bsd_fat32
mount: /dev/label/bootfs-unirex-2224g: Operation not supported by device
fred@fred-pc ~ [1]> su root
Password:
root@fred-pc:/home/fred # mount -t fat32 /dev/label/bootfs-unirex-2 /mnt/bsd_fat32
mount: /dev/label/bootfs-unirex-2: Operation not supported by device
root@fred-pc:/home/fred #
root@fred-pc:/home/fred # ls /mnt /dev/label /dev/gpt /dev/gptid /dev/diskid
/dev/diskid:
DISK-333457EBD0F2 DISK-333457EBD0F2p2
DISK-333457EBD0F2p1 DISK-333457EBD0F2p3
/dev/gpt:
swap-internal-disk
/dev/gptid:
7d0e6dcf-7926-11ec-b6e6-0021ccd45dec
801fd8c2-7926-11ec-b6e6-0021ccd45dec
873d142e-6117-de4f-bd8c-3075b666793f
d53c24c9-8a7e-7b44-97f0-97311087d9fa
/dev/label:
bootfs-unirex-2 swap-unirex-224
/mnt:
bsd_fat32 swap_space
root@fred-pc:/home/fred #