User:Andy Crowd/sandbox/Live CD

From ArchWiki

Live CD custom commands

Check sensors

CPU temp

acpi -t | awk '{TT=$4;split(TT,AA,".");print AA[1]}'

CPU + GPU temp

sensors | grep -e 'Core 0' -e temp1 |awk -F'+' '{TT=$2;split(TT,II,".");print II[1]}'

SSD temp

smartctl -a /dev/sda | grep  Temp | awk -F'-'  '{TT=$2;split(TT,SS,"(");split(SS[1],AA," ");if( AA[1] != "fail" )print AA[1]}' | head -1

HDD temp

smartctl -a /dev/sda | grep  Temp | awk -F'-'  '{TT=$2;split(TT,SS,"(");split(SS[1],AA," ");if( AA[1] != "fail" )print AA[1]}' | tail -1

Battery check

Load
upower -i $(upower -e| grep BAT) | grep 'percentage:' | awk '{TT=$2;split(TT,II,"%");print II[1]}' | head -1
Status
upower -i $(upower -e| grep BAT) | grep 'state' | awk '{print $2}' | head -1

Complete script body to use on Live CD:

gsens.sh
#!/bin/bash

if [ 'XX' != 'XX'$(upower -e| grep BAT) ];then

echo Charged::
upower -i $(upower -e| grep BAT) | grep 'percentage:' | awk '{TT=$2;split(TT,II,"%");print II[1]}' | head -1
echo Status::
upower -i $(upower -e| grep BAT) | grep 'state' | awk '{print $2}' | head -1

echo
fi

echo :: CPU + MB + GPU
sensors | grep '('
acpi -t
echo

if [ 'XX'"$1" != 'XX'  ]; then
DiskTemp=($(lsblk -o NAME | grep -v -e '─' -e ^'NAME'))
if [ ${#DiskTemp[@]} != 0 ]; then
echo :: Disks
for ((i=0;i <= ${#DiskTemp[@]};i++ ));do
echo : /dev/${DiskTemp[i]}
smartctl -a /dev/${DiskTemp[i]} | grep Temp |
awk -F'-'  '{ST=$1;split(ST,TNames," ");TT=$2;split(TT,SS,"(");split(SS[1],AA," ");
if( AA[1] != "fail" )print TNames[2] " " AA[1]}'
done
fi;fi

Basic checks, hardware support, benchmark

List loaded modules + list if how to custom tests

Network + ifconfig, ping

Video/Webcam ls /dev/ | grep video + mplayer + xawtv

Sound lsmod | grep ^snd + speakertest + alsamixer

Mic arecord,aplay

Graphic startx /usr/bin/window manager

Benchmark - phoronix-test-suite, glxgears mesa-demos.

Change / show the screen resolution
alias setres="xrandr  --output `xrandr | grep ' connected'|awk '{print $1}'|head -1` --mode"
alias cures="xrandr | grep -e ' connected' -e '*'"

Storage management

Get alla available temperature values
gtemp
#!/bin/bash
if [ "XX$1" != "XX"  ];then
smartctl -A $1| grep Temperature|awk '{print ": "$2" "$10}'
fi
List symlinks in /dev/disk/by-id/ without extras
$  ls -gG --time-style="+" --hide=*part* --hide=*-0x* -F /dev/disk/by-id/ |
sed -e 's/[^. ]* //m' -e 's/^.//m' -e 's/[^*]*  //g' | grep -v ^$
List info about drives for a bash script
$ lsblk -o NAME,FSTYPE,SIZE | grep -e '─' | awk -F'─' '{printf $2 "\n" }' | 
awk '{if ( "A"$3 == "A" ) printf "--Unknown: "$1" "$2" "; 
else printf $3" Partition: "$1" :FS: "$2" :df -h "; 
system("df -h /dev/"$1"|grep -v Size" );printf "\n"}'; 
echo "NOTE: df -h: Filesystem Size  Used Avail Use% Mounted on"
450G Partition: sda1 :FS: ext4 :df -h /dev/sda1       443G  128G  293G  31% /

10G Partition: sda2 :FS: ext4 :df -h dev             3,9G     0  3,9G   0% /dev

--Unknown: sda4 1K dev             3,9G     0  3,9G   0% /dev

5,8G Partition: sda5 :FS: swap :df -h dev             3,9G     0  3,9G   0% /dev

NOTE: df -h: Filesystem Size Used Avail Use% Mounted on
Version 2 of output, use gtemp script from above
$ ls -gG --time-style="+" --hide=*part* --hide=*-0x* -F /dev/disk/by-id/ |
sed -e 's/[^.* ]* //m' -e 's/[^.* ]* //m' -e 's/[^.* ]*  //m' |
 awk -F'-' '{AA=substr($0,$3);sub(/> ..\/\..\//," ",AA);sub(/^.* /,"",AA);
if( AA"XX" != "XX" &&  AA"XX" != 0"XX" ){
system("XX=$(cat /sys/block/"AA"/queue/rotational);if [ $XX == 0 ];then printf SSD;else printf HDD;fi");
print " "$1" ""/dev/"AA" |"$2" ";system("gtemp /dev/"AA);
system("ZZ=($(lsblk -o NAME,SIZE /dev/"AA"| grep -v -e NAME -e ─));echo : ${ZZ[1]};echo : $(ls /dev/"AA"* | grep -v "AA"$)" )} }'

SSD ata /dev/sdc |Samsung_SSD_840_EVO_120GB_S1D5NSBF314777Z  
: Airflow_Temperature_Cel 27
: 111,8G
: /dev/sdc1 /dev/sdc2 /dev/sdc3 /dev/sdc4 /dev/sdc5 /dev/sdc6
HDD ata /dev/sdb |ST2000DM001 
: Airflow_Temperature_Cel 30
: Temperature_Celsius 30
: 1,8T
: /dev/sdb1 /dev/sdb2 /dev/sdb5
HDD ata /dev/sda |ST3500413AS_Z2A70JPN  
: Airflow_Temperature_Cel 26
: Temperature_Celsius 26
: 465,8G
: /dev/sda1 /dev/sda2 /dev/sda4 /dev/sda5
Short base storage list
alias lsblks="lsblk -o SIZE,NAME,FSTYPE,MODEL"
List USB storage only

Names only $ ls -l1 /dev/disk/by-id/ | grep -v part |grep usb | awk -F'../../' '{system("lsblk -o NAME,RO,RM,FSTYPE,MODEL /dev/"$2)}'

More details with use of the lsblk command

$ ls -l1 /dev/disk/by-id/usb*|grep -v part | 
sed -e 's/^[^.*]*\.\.\.*//m' -e  's/^[^.*]..\/*/\/dev\//m' | 
awk '{system("lsblk -o NAME,SIZE,FSTYPE "$1)}'
NAME    SIZE FSTYPE
sdd    14,4G iso9660
├─sdd1    5G ext4
├─sdd2    1K iso9660
└─sdd5    3G vfat
Show HDD and SSD only
$ ls -l1 /dev/disk/by-id/ata* | grep -v part | 
sed -e 's/^[^.*]*\.\.\.*//m' -e  's/^[^.*]..\/*//m' | 
awk '{printf $1" ";system("cat /sys/block/"$1"/queue/rotational") }' |
awk '{if ( $2 == 0 )print "/dev/"$1 " SSD " ;else print "/dev/"$1" HDD "}'|
awk '{printf $2" /dev/";system("lsblk -o NAME,SIZE "$1"| grep -v -e NAME -e ─" )}'
SSD /dev/sdc    111,8G
HDD /dev/sdb     1,8T
HDD /dev/sda    465,8G

ArchISO build problem

Fix the Live CD boot problem: cannot find an unused loop device [1].

Add the earlymodules=loop into the syslinux/archiso_sys32.cfg and/or syslinux/archiso_sys64.cfg file to APPEND variable as parameter to the kernel, e.g.

APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% earlymodules=loop
Note: Problem with the X startup was fixed by copying X11 configuration files from Archbang

.

Acronis ISO add to archiso Live CD. syslinux config lines
LABEL acronis
KERNEL memdisk
INITRD /path_to_iso/file.iso
APPEND iso raw

"Acronis True Image Home 2011 Build: #6942 ISO Size: 137.75 MB" can restore images made by "Acronis True Image 2015 for PC Build: #6525 ISO Size: 477.13 MB"

Supported by acronis kernel commands.