Sunday, November 15, 2015

Best inventory command like tool for linux!

I've been looking around for a nice tool to give me information about my machine. Yes, I know there's lspci etc etc etc, but these are pretty spamy, ugly and take a while to decipher. To the rescue comes inxi. To me it's exactly what I've been looking for. I run it like this:
# inxi -Fi
System:    Host: XXXXXXXXX Kernel: 3.16.0-30-generic x86_64 (64 bit) Console: tty 0 Distro: Ubuntu 14.04 trusty
Machine:   System: Xen product: HVM domU version: 4.1.5 serial: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
           Mobo: N/A model: N/A Bios: Xen version: 4.1.5 date: 06/14/2013
CPU:       Quad core Intel Xeon CPU E5645 (-HT-MCP-) cache: 12288 KB flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3)
           Clock Speeds: 1: 2400.146 MHz 2: 2400.146 MHz 3: 2400.146 MHz 4: 2400.146 MHz
Graphics:  Card: Cirrus Logic GD 5446 X-Vendor: N/A driver: N/A tty size: 164x47 Advanced Data: N/A for root out of X
Network:   Card: Failed to Detect Network Card!
           WAN IP: 62.0.100.191 IF: eth0 ip: 192.168.3.202
Drives:    HDD Total Size: 64.4GB (2.5% used) 1: id: /dev/xvda model: N/A size: 64.4GB
Partition: ID: / size: 51G used: 1.5G (4%) fs: ext4 ID: swap-1 size: 8.85GB used: 0.00GB (0%) fs: swap
RAID:      No RAID devices detected - /proc/mdstat and md_mod kernel raid module present
Sensors:   None detected - is lm-sensors installed and configured?
Info:      Processes: 128 Uptime: 8 min Memory: 172.1/7979.7MB Runlevel: 2 Client: Shell (bash) inxi: 1.9.17

Thursday, October 29, 2015

Setting up multiple hard drives at once on Ubuntu

Sometimes you need to set up multiple hard drives sequentially, say for example for a Hadoop data node.
Here's how you do it quick and easy:
# for hdd in /dev/sd{c..h};do echo -e "n\n\n\n\n\nw\n\n"|fdisk $hdd;mkfs.ext4 ${hdd}1;done

In order to automount, use:
# blkid

Add/replace the UUID of the new HDD in /etc/fstab like the following examples:
UUID=b8923549-5794-4cad-89b3-0813fafb9566 /            ext4    errors=remount-ro 0       1
UUID=f0fc9526-0579-4116-994b-c79878f7f393 /hdfs/10    ext4    noatime 0    1

Changing UUID of an existing partition:
# tune2fs /dev/sdl1  -U d81ce3c1-27fa-4a37-8d61-3bebc7ac4e92

Extra options:
  • Enable writeback mode. This mode will typically provide the best ext4 performance.
# tune2fs -o journal_data_writeback /dev/sda10
  • Delete has_journal option
# tune2fs -O ^has_journal /dev/sda10