List block devices FreeBSD


  • administrators

    List hard drives USB optical media

    camcontrol devlist
    

    For more detail:

    gpart list
    

    Here is the mess I get on this machine currently from the latter:

    Geom name: ada0
    modified: false
    state: OK
    fwheads: 16
    fwsectors: 63
    last: 976773167
    first: 63
    entries: 4
    scheme: MBR
    Providers:
    1. Name: ada0s1
       Mediasize: 500107825152 (466G)
       Sectorsize: 512
       Stripesize: 0
       Stripeoffset: 32768
       Mode: r3w3e5
       attrib: active
       rawtype: 165
       length: 500107825152
       offset: 32768
       type: freebsd
       index: 1
       end: 976773159
       start: 64
    Consumers:
    1. Name: ada0
       Mediasize: 500107862016 (466G)
       Sectorsize: 512
       Mode: r3w3e8
    
    Geom name: ada0s1
    modified: false
    state: OK
    fwheads: 16
    fwsectors: 63
    last: 976773095
    first: 0
    entries: 8
    scheme: BSD
    Providers:
    1. Name: ada0s1a
       Mediasize: 2147483648 (2.0G)
       Sectorsize: 512
       Stripesize: 0
       Stripeoffset: 32768
       Mode: r1w1e1
       rawtype: 27
       length: 2147483648
       offset: 0
       type: freebsd-zfs
       index: 1
       end: 4194303
       start: 0
    2. Name: ada0s1b
       Mediasize: 2147483648 (2.0G)
       Sectorsize: 512
       Stripesize: 0
       Stripeoffset: 2147516416
       Mode: r1w1e0
       rawtype: 1
       length: 2147483648
       offset: 2147483648
       type: freebsd-swap
       index: 2
       end: 8388607
       start: 4194304
    3. Name: ada0s1d
       Mediasize: 495812853760 (462G)
       Sectorsize: 512
       Stripesize: 0
       Stripeoffset: 32768
       Mode: r1w1e1
       rawtype: 27
       length: 495812853760
       offset: 4294967296
       type: freebsd-zfs
       index: 4
       end: 976773087
       start: 8388608
    Consumers:
    1. Name: ada0s1
       Mediasize: 500107825152 (466G)
       Sectorsize: 512
       Stripesize: 0
       Stripeoffset: 32768
       Mode: r3w3e5
    
    Geom name: ada1
    modified: false
    state: OK
    fwheads: 16
    fwsectors: 63
    last: 976773167
    first: 63
    entries: 4
    scheme: MBR
    Providers:
    1. Name: ada1s1
       Mediasize: 500107825152 (466G)
       Sectorsize: 512
       Stripesize: 4096
       Stripeoffset: 0
       Mode: r3w3e5
       attrib: active
       rawtype: 165
       length: 500107825152
       offset: 32768
       type: freebsd
       index: 1
       end: 976773159
       start: 64
    Consumers:
    1. Name: ada1
       Mediasize: 500107862016 (466G)
       Sectorsize: 512
       Stripesize: 4096
       Stripeoffset: 0
       Mode: r3w3e8
    
    Geom name: ada1s1
    modified: false
    state: OK
    fwheads: 16
    fwsectors: 63
    last: 976773095
    first: 0
    entries: 8
    scheme: BSD
    Providers:
    1. Name: ada1s1a
       Mediasize: 2147483648 (2.0G)
       Sectorsize: 512
       Stripesize: 4096
       Stripeoffset: 0
       Mode: r1w1e1
       rawtype: 27
       length: 2147483648
       offset: 0
       type: freebsd-zfs
       index: 1
       end: 4194303
       start: 0
    2. Name: ada1s1b
       Mediasize: 2147483648 (2.0G)
       Sectorsize: 512
       Stripesize: 4096
       Stripeoffset: 0
       Mode: r1w1e0
       rawtype: 1
       length: 2147483648
       offset: 2147483648
       type: freebsd-swap
       index: 2
       end: 8388607
       start: 4194304
    3. Name: ada1s1d
       Mediasize: 495812853760 (462G)
       Sectorsize: 512
       Stripesize: 4096
       Stripeoffset: 0
       Mode: r1w1e1
       rawtype: 27
       length: 495812853760
       offset: 4294967296
       type: freebsd-zfs
       index: 4
       end: 976773087
       start: 8388608
    Consumers:
    1. Name: ada1s1
       Mediasize: 500107825152 (466G)
       Sectorsize: 512
       Stripesize: 4096
       Stripeoffset: 0
       Mode: r3w3e5
    
    Geom name: da0
    modified: false
    state: CORRUPT
    fwheads: 255
    fwsectors: 63
    last: 30310359
    first: 40
    entries: 152
    scheme: GPT
    Providers:
    1. Name: da0p1
       Mediasize: 2147483648 (2.0G)
       Sectorsize: 512
       Stripesize: 0
       Stripeoffset: 65536
       Mode: r0w0e0
       rawuuid: 107c86ad-1192-11e8-a477-001966e9f863
       rawtype: 516e7cb5-6ecf-11d6-8ff8-00022d09712b
       label: (null)
       length: 2147483648
       offset: 65536
       type: freebsd-swap
       index: 1
       end: 4194431
       start: 128
    2. Name: da0p2
       Mediasize: 13371351040 (12G)
       Sectorsize: 512
       Stripesize: 0
       Stripeoffset: 2147549184
       Mode: r0w0e0
       rawuuid: 1092e574-1192-11e8-a477-001966e9f863
       rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
       label: (null)
       length: 13371351040
       offset: 2147549184
       type: freebsd-zfs
       index: 2
       end: 30310351
       start: 4194432
    Consumers:
    1. Name: da0
       Mediasize: 15518924800 (14G)
       Sectorsize: 512
       Mode: r0w0e0
    
    Geom name: iso9660/ESXI-6.5.0-20170104001-STANDARD
    modified: false
    state: CORRUPT
    fwheads: 255
    fwsectors: 63
    last: 30310359
    first: 40
    entries: 152
    scheme: GPT
    Providers:
    1. Name: iso9660/ESXI-6.5.0-20170104001-STANDARDp1
       Mediasize: 2147483648 (2.0G)
       Sectorsize: 512
       Stripesize: 0
       Stripeoffset: 65536
       Mode: r0w0e0
       rawuuid: 107c86ad-1192-11e8-a477-001966e9f863
       rawtype: 516e7cb5-6ecf-11d6-8ff8-00022d09712b
       label: (null)
       length: 2147483648
       offset: 65536
       type: freebsd-swap
       index: 1
       end: 4194431
       start: 128
    2. Name: iso9660/ESXI-6.5.0-20170104001-STANDARDp2
       Mediasize: 13371351040 (12G)
       Sectorsize: 512
       Stripesize: 0
       Stripeoffset: 2147549184
       Mode: r0w0e0
       rawuuid: 1092e574-1192-11e8-a477-001966e9f863
       rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
       label: (null)
       length: 13371351040
       offset: 2147549184
       type: freebsd-zfs
       index: 2
       end: 30310351
       start: 4194432
    Consumers:
    1. Name: iso9660/ESXI-6.5.0-20170104001-STANDARD
       Mediasize: 15518924800 (14G)
       Sectorsize: 512
       Mode: r0w0e0
    

 



  • Make ISO from DVD

    In this case I had an OS install disk which was required to be on a virtual node with no optical drive, so I needed to transfer an image to the server to create a VM

    Find out which device the DVD is:

    lsblk

    Output:

    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 465.8G 0 disk ├─sda1 8:1 0 1G 0 part /boot └─sda2 8:2 0 464.8G 0 part ├─centos-root 253:0 0 50G 0 lvm / ├─centos-swap 253:1 0 11.8G 0 lvm [SWAP] └─centos-home 253:2 0 403G 0 lvm /home sdb 8:16 1 14.5G 0 disk /mnt sr0 11:0 1 4.1G 0 rom /run/media/rick/CCSA_X64FRE_EN-US_DV5

    Therefore /dev/sr0 is the location , or disk to be made into an ISO

    I prefer simplicity, and sometimes deal with the fallout after the fact, however Ive repeated this countless times with success.

    dd if=/dev/sr0 of=win10.iso

    Where if=Input file and of=output file

    I chill out and do something else while the image is being copied/created, and the final output:

    8555456+0 records in 8555456+0 records out 4380393472 bytes (4.4 GB) copied, 331.937 s, 13.2 MB/s

    Fin!

    read more
  • Recreate postrgresql database template encode to ASCII

    UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';

    Now we can drop it:

    DROP DATABASE template1;

    Create database from template0, with a new default encoding:

    CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE'; UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1'; \c template1 VACUUM FREEZE;

    read more
});