Archive

Posts Tagged ‘ubuntu’

Easy SSH Login

March 30th, 2017 No comments

Here is a simple way to setup key (password-less) login on Unix-like systems.

Once you’ve configured SSH locally, add your public key to remote hosts using the following command:

**NB** in the next line, be very careful to use cat >> (append) and not cat > (overwrite), or you will trash your remote authorized_keys2 file, leaving your remote inaccessible to everyone but you. Not cool.

cat ~/.ssh/id_rsa.pub | ssh remote_machine 'cat >> .ssh/authorized_keys2'

Replace .ssh/id_rsa.pub with your public key.

Also make sure remote folder ~/.ssh has mode 0700 and ~/.ssh/authorized_keys2 has 0600.

 

Categories: Linux Tags: , , , , ,

btrfs RAID1 with bcache on Ubuntu

November 12th, 2014 1 comment

How to install btrfs in RAID1, with bcache, on Ubuntu.

To avoid problems, use the most recent kernel you can. I did all this on Ubuntu 14.04 LTS but with Linux kernel 3.17.
Earlier kernels (btrfs versions) reported all sorts of unpleasantness in dmesg. 3.17 works.

First, install bcache tools

sudo add-apt-repository ppa:g2p/storage
sudo apt-get update
sudo apt-get install bcache-tools

I tried a bunch of recipes that failed. Several suggested it was possible to migrate existing btrfs volumes to use bcache.
Nothing I found came close to working without completely rebuilding the btrfs volumes.

MAKE A BACKUP – THIS WILL ERASE EVERYTHING ON YOUR HARD DRIVE

So I did an 800+GB backup and started from scratch. This recipe worked:

My setup:

2 x 3TB Seagate HDD backing store – /dev/sdc & /dev/sdd
40GB partition on Samsung SSD cache – /dev/sda6

Create bcache devices (-B for backing devices HDD; -C for cache device SSD):

$ make-bcache –wipe-bcache –writeback -B /dev/sd[cd] -C /dev/sda6

Build RAID1 btrfs on bcache devices:

$ mkfs.btrfs -f -d raid1 -m raid1 /dev/bcache0 /dev/bcache1

Get device id needed for /etc/fstab:

$ blkid /dev/bcache0
/dev/bcache0: UUID=”eccb74e8-6cae-850a-4eac-d217b11e21a4″ UUID_SUB=”9da2d9dc-6636-9de4-4293-169894f750ba” TYPE=”btrfs”

Updating /etc/fstab:

UID=eccb74e8-6cae-850a-4eac-d217b11e21a4 /big        btrfs   defaults,subvolid=0  0   0

If necessary, regenerate initramfs:

$ update-initramfs -u -k all

And voila, it worked!

 

Handy links:

https://bcache.evilpiepirate.org/

https://btrfs.wiki.kernel.org/index.php/Using_Btrfs_with_Multiple_Devices

https://bbs.archlinux.org/viewtopic.php?id=178230 & https://pastebin.com/ZwwZMd40

 

Troubleshooting steps for when things go wrong (and they likely will):

Wipe out file system id on cache device:

$ wipefs -a /dev/sda6

or on backing device:

$ wipefs -a /dev/sdd

More/different ways to wipe out file system info:

$ dd if=/dev/zero count=1 bs=1024 seek=1 of=/dev/sda6
$ dd if=/dev/zero count=1024 bs=1024 seek=1 of=/dev/sda6

I had to use gdisk to wipe GPT table from backing devices. ‘x’ for advanced, ‘z’ to zap partition table:

$ gdisk

Lots of reboots to synchronize bcache. There’s probably a better way, but this worked:

$ reboot

Display a bunch of useful block dev info:

$ lsblk -o NAME,MAJ:MIN,RM,SIZE,TYPE,FSTYPE,MOUNTPOINT,UUID

NAME MAJ:MIN RM SIZE TYPE FSTYPE MOUNTPOINT UUID
sda 8:0 0 232.9G disk
├─sda1 8:1 0 177.9G part btrfs 71cbb2af-7bd3-9d04-4800-1b1841c88ce1
├─sda2 8:2 0 1K part
├─sda5 8:5 0 15.5G part swap [SWAP] ed662fe6-0f76-9a1e-418c-ad26d15b9234
└─sda6 8:6 0 39.4G part
├─bcache0 251:0 0 2.7T disk btrfs eccb74e8-6cae-850a-4eac-d217b11e21a4
└─bcache1 251:1 0 2.7T disk btrfs eccb74e8-6cae-850a-4eac-d217b11e21a4
sdb 8:16 0 465.8G disk
sdc 8:32 0 2.7T disk
└─bcache0 251:0 0 2.7T disk btrfs eccb74e8-6cae-850a-4eac-d217b11e21a4
sdd 8:48 0 2.7T disk
└─bcache1 251:1 0 2.7T disk btrfs eccb74e8-6cae-850a-4eac-d217b11e21a4
sde 8:64 0 2.7T disk
├─sde1 8:65 0 1T part ext4 /mnt/ext4 693ac7fb-fc0c-b76d-4215-fe5c10df5a1a
└─sde2 8:66 0 1T part xfs 72f87cdb-8149-973a-4863-ca3c4063cba9

Categories: Linux Tags: , , , , , , ,

SystemRescueCd

December 31st, 2010 No comments

The SystemRescueCd has all sorts of useful tools to restore ailing Linux systems.
Check it out at: https://www.sysresccd.org

Thinkpad TrackPoint Scrolling in Ubuntu Lucid/10.04

July 10th, 2010 No comments

From Phil Sung:

Another Ubuntu release, another set of X.org shakeups.

Some things in X changed in Lucid (xorg 1:7.5+5 and higher), breaking existing Thinkpad TrackPoint scrolling configurations that modify files in /etc/hal/fdi/policy (like those you may have seen in this previous post). You can use gpointing-device-settings to apply the same policy, but I found that even that stops working after a suspend/resume cycle.

Samson Yeung pointed out to me the following fix which can be applied on Ubuntu Lucid/10.04:

Create a new file /usr/lib/X11/xorg.conf.d/20-thinkpad.conf with the following contents:

Section “InputClass”
Identifier “Trackpoint Wheel Emulation”
MatchProduct “TrackPoint”
MatchDevicePath “/dev/input/event*”
Driver “evdev”
Option “EmulateWheel” “true”
Option “EmulateWheelButton” “2”
Option “Emulate3Buttons” “false”
Option “XAxisMapping” “6 7”
Option “YAxisMapping” “4 5”
EndSection
Then restart X.

The configuration above works for both Thinkpad laptops with TrackPoints and the Thinkpad TrackPoint keyboard.

Dualhead on ThinkPad T60p Running Ubuntu Hardy

September 8th, 2008 No comments

Somehow my ThinkPad (T60p) desktop never seems big enough so whenever possible I like to plug in a second monitor. Until recently, Ubuntu required all sorts of messing around in xorg.conf, but fortunately the situation is somewhat improved with Hardy. To be fair, much of this configuration mess is probably due to ATI’s less than stellar Linux support, which is slowly improving.

First, always backup your existing /etc/X11/xorg.conf !!!  Virtually every screen config tool I’ve used under Linux has ultimately toasted my xorg.conf file.

I found “amdcccle” produced the best results, with Compiz still operational.

Others may prefer “aticonfig –initial=dual-head“, which also worked but left my Compiz out of action.

Both are far from perfect and this is one area where Ubuntu (and other distros) still lag far behind Windows and OSX.

Categories: Uncategorized Tags: , , , , , ,