Computing

Computers and information management topics

Incomplete article. This is a work in process.

RAID setup

Assemble

This can be necessary when making other drive configuration changes that impact the drive device letters.

mdadm -A or --assemble <-- the assemble option, followed by the array device then the drive devices to be used in the array.

Example:
sudo mdadm --assemble /dev/md0 /dev/sdb1 /dev/sdc1

Save configuration for boot

After completion, save the configuration to the boot ram disk.

sudo update-initramfs -u -v

RAID decommission

Stop

The array is "disassembled" but no changes are made to the drives included in the array or configuration.

sudo mdadm --stop /dev/md0

Then to erase the array configuration on the drives included in the array so they are not rebuilt on the next boot.

sudo mdadm --zero-superblock /dev/sda1 /dev/sdb1

It might also be required to edit /etc/mdadm/mdadm.conf to remove the array configuration line.

Some commands that aid with managing the mail queue in Postfix.

Show mail queue size:

mailq

or

postqueue -p

Show queue domain and age:

qshape

qshape deferred

-s Display the sender domain distribution instead of the recipient domain distribution

Queues:

deferred
recipients delivery failed for a transient reason (it might succeed later), the message is placed in the "deferred" queue
active
Messages in the "active" queue are ready to be sent (runnable), but are not necessarily in the process of being sent (running)
incoming
All new mail entering the Postfix queue is written into the "incoming" queue
hold
Administrator defined rules place messages into the "hold" queue and stay there until the administrator intervenes
maildrop
Messages that have been submitted via the sendmail command, but not yet brought into the main queue, await processing in the "maildrop" queue

Purge a single email:

postsuper -d [message id]

Purge all emails:

postsuper -ALL

 

In versions up to 3.10.2, all weblinks are listed in a category by id ordering. That is the order as shown in the "ordering" administrator view. I would like them listed by default in alphabetical title order. There does not seem to be any option for this sort order. So I have implemented the following code change.

To configure various audio programs it is common that you will need the device name or some other designation. But, if you have multiple audio devices, which is increasingly common (sound on mother board, sound card, USB mic, USB camera with mic, external DAC, etc), how do you get a list?

To list the ALSA audio hardware:

aplay -l

**** List of PLAYBACK Hardware Devices **** 
card 1: C2 [Cambridge Audio DAC100 USB 2], device 0: USB Audio [USB Audio]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 2: HDMI [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 2: HDMI [HDA Intel HDMI], device 7: HDMI 1 [HDMI 1]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 2: HDMI [HDA Intel HDMI], device 8: HDMI 2 [HDMI 2]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 2: HDMI [HDA Intel HDMI], device 9: HDMI 3 [HDMI 3]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 3: PCH [HDA Intel PCH], device 0: ALC662 rev3 Analog [ALC662 rev3 Analog]
 Subdevices: 1/1
 Subdevice #0: subdevice #0

In the above list, I am seeking to use the "Cambridge DAC" so would choose hw:1,0. However, USB devices might not get the same device numbers each time they're plugged in or when the computer reboots. So, the "hw:X,Y" device shown above might change. To solve this consider using the device alias rather than the hardware listing.

To list the audio device aliases:

aplay -L

hw:CARD=C2,DEV=0 
   Cambridge Audio DAC100 USB 2, USB Audio
   Direct hardware device without any conversions
plughw:CARD=C2,DEV=0
   Cambridge Audio DAC100 USB 2, USB Audio
   Hardware device with all software conversions
iec958:CARD=C2,DEV=0
   Cambridge Audio DAC100 USB 2, USB Audio
   IEC958 (S/PDIF) Digital Audio Output

In the above output list "IEC958" is a standard defining digital connections for consumer electronics based on S/PDIF. This can be the best choice to use for an external (high quality) device. So, I would use iec958:CARD=C2,DEV=0.

To list pulse audio sources:

pactl list short sources

And to list pulse audio sinks:

pactl list short sinks

which shows the device name "alsa_output.usb-Cambridge_Audio_Cambridge_Audio_DAC100_USB_2_0000-00.analog-stereo".

I use this information in an audio application's configuration file. For example, in MPD I edit the mpd.conf audio output section:

audio_output {
    type "alsa"
    name "My ALSA output"
    device "iec958:CARD=Intel,DEV=0"
    mixer_control "PCM"
}

A properly formed URL can instruct Piwigo to generate a re-sized image. The structure is as follows:

Two commands are most useful for managing services on a Ubuntu Linux computer; service and systemctl.

Re-format text blocks to wrap to a fixed character width

  1. Set the text width in characters :set textwidth=80
  2. Select the lines of text you want to re-format v to use visual selection
  3. Reformat gq
  4. To reformat a single paragraph without selecting it first {gq}

Turn on (or off) line numbering

  1. To turn on line numbering, at the : prompt type set number
  2. To turn off line numbering, type the command set nonumber
  3. To set relative line numbers set relativenumber

Insert a comment character as the first character in a sequence of lines (i.e., comment a block)

  1. Position the cursor on the first character in the first line to be commented
  2. Press Ctrl-V to enter VISUAL BLOCK mode
  3. Use arrow keys to select the first character in each line until the last line in sequence
  4. Press Shift-I (the i key), which will put the editor in INSERT mode
  5. Press #, the character to be inserted at the start of each line, note that it will not yet appear on screen
  6. Press Esc (wait a couple of seconds), the # character will appear at the start of each line

Remove comment characters from multiple lines

  1. Assuming # is the comment character, put your cursor on the first # character, press Ctrl-V
  2. Use arrow keys to go down until the last commented line, the first character in each line should be highlighted
  3. Press x to delete all the selected # characters