Miscellaneous Stuff I've Learned In Linux

Introduction

    This is a page where I put all kinds of interesting and random stuff I've learned how to do with Linux (or how NOT to do).  Enjoy!
    NOTE: this page is old, so your mileage may vary.

Working With USB Sticks

    First of all, If your USB stick don't work, check the output of

dmesg | tail

and find out why.  Usually there is a reason.  For example, I tried using an UltraNet USB Flash Disk (1GB stick for $7, what's not to like?) and it wouldn't register the device.  I looked and the usbtouchscreen module was being loaded because that's what Linux thought it was.  This was a simple fix:

echo blacklist usbtouchscreen >> /etc/modprobe.d/blacklist.conf

and then yank it out and reinsert.
    Second, if you want to back up the contents of such a stick, one way to do so is to use dd and compress/uncompress.  First, to back it up, you can:

dd if=/dev/sdb of=/tmp/usbstick.raw && compress /tmp/usbstick.raw

Then to restore it:

uncompress -c /tmp/usbstick.raw | dd if=/dev/stdin of=/dev/sdb

Be sure that you check CAREFULLY that you are using the right files and devices: doing this to your laptop's hard drive can be catastrophic!  The program dd is very powerful!  I did this to backup and save the contents of a 1GB bootable USB stick.

Working with LUKS and LVM2

    LUKS is the Linux Unified Key System (i.e. disk encryption), and LVM is Logical Volume Manager (i.e. not physical volumes, i.e. not partitions).
    Yesterday I accidentally made my root filesystems too small for Slackware and Slackware64.  However, with LUKS and LVM fixing the problem was very easy.
    As a caution, as of when I wrote this, you cannot resize LUKS partitions.  Don't bother trying.  Back up your stuff if you need to resize LUKS.
    With LVM, I was able to fix the problem of running out of size.  First, I recreated the cryptvg/home partition (as I had not yet restored my stuff from backup) to the proper size, then I enlarged cryptvg/slack and cryptvg/slack64.  Without LVM I would have to recreate these partitions or hope that GParted could resize them properly.  Then I resized the ext4 filesystems on the fly.  Without LVM, all data would've been lost during the process, but not with LVM.
    Not much information as of yet but I just wanted to make sure that I let people know that 1) LVM gives you flexibility and 2) you cannot resize LUKS partitions (as of writing this).