Wednesday, December 14, 2011

disk information and format

It is quote common that you need information about disk. There are many commands (sometimes distribution depended) that can do that. Try following:

lshw -class disk
smartctl -i /dev/sda
hdparm -i /dev/sda
hwinfo --disk
ls /dev/disk/by-id
cat /proc/partitions

cat /proc/mdstat

To add new disk you just need

fdisk -l
parted /dev/sdb
(parted) mklabel GPT                                                      
(parted) mkpart primary 0% 100%                                           
(parted) quit
mkfs.ext4 /dev/sdb1
tune2fs -m 0 /dev/sdb1

Add line to /etc/fstab

Friday, January 28, 2011

identify problem

If something does not work first look at logs :
cat /var/log/syslog
dmesg


But there are not only these logs (see /var/log folder).

For hardware identify what was determined :
lsusb
lspci
lshal
lshw


There you easily find vendor or identification for hardware.

For software (run by command) try:
strace command


or use verbose output of command, often by:
command --verbose



For open files, see:
lsof

Mentioned utilities have many options, so try arguments. Use keywords from previous outputs to feed goog..