Resizing an ext3 filesystem on an lvm
Just a short reference:
Keep in mind: There is no longer a need to convert the filesystem to ext2 to resize it. resize2fs can handle ext3 just fine.
First, unmount the filesystem in question, unless you have and trust online resizing (I can't subscribe to either). Then check it for errors like this:
# e2fsck -f /dev/VolGroup00/LogVol00 (replace the path with that of the device you just unmounted)
Get an overview of what you currently have allocated
# lvs
Save said overview
# lvs > maybe_useful.txt
Resize a given filesystem to 50 gigs (read man lvreduce/lvextend to learn how to resize using relative sizes, like reducing the filesystem by 5 gigs)
# resize2fs -p /dev/VolGroup00/LogVol00 50G
Run a new check on the filesystem, just to be sure it worked well
# e2fsck -f /dev/VolGroup00/LogVol00
Resize the lvm partition to fit the filesystem (I usually go a bit higher than the filesystem, just to make sure there's room for it, then resize the filesystem again to fill the partition afterwards)
# lvreduce -L55G /dev/VolGroup00/LogVol00
Expand the other partition to use the space you just freed up (this will use all available space. again, read manual for how to use only part of the space if you want to extend more lvm's to fit the space you just made available)
# lvextend /dev/VolGroup00/LogVol01 /dev/md1 (md1 is the physical device I wish to fill)
Extend both filesystems to fit their partitions and check them both afterwards
# e2fsck -f /dev/VolGroup00/LogVol01 # resize2fs -p /dev/VolGroup00/LogVol00 # resize2fs -p /dev/VolGroup00/LogVol01 # e2fsck -f /dev/VolGroup00/LogVol00 # e2fsck -f /dev/VolGroup00/LogVol01
Re-mount your filesystems, and hopefully everything went well
Moving or removing ~/.xsession-errors
The location of ~/.xsession-errors is, at the time of writing, specified in /etc/X11/Xsession in Debian Squeeze (testing).
ERRFILE=$HOME/.xsession-errors
To disable logging, change this to
ERRFILE=/dev/null
I use several computers with the same, networked, home directory, and having all of them output to the same file was a hopeless mess. However, this solved the problem for me:
ERRFILE=$HOME/.xsession-errors-$(hostname -s) rm -f "$ERRFILE"
This makes a separate .xsession-errors for each of my machines and also removes the file each time X is started so it doesn't grow too big. If X itself crashes, the errors to to /var/log/messages anyway, so there's no need to save the .xsession-errors for this.
Wake on Lan on an Intel Mac Mini with Linux
Both Wake on Lan and turning on after a power loss can be enabled on the Intel Mac Mini with the use of the setpci command. I stuffed this into my /etc/rc.local (to run them at boot time. yes, they need to be run on each boot)
# reboot on power loss setpci -s 0:1f.0 0xa4.b=0 # wake on lan setpci -d 8086:27b9 0xa4.b=0 ethtool -s eth1 wol g
Don't ask me what they mean. I have no idea.
Note: this requires ethtool to be installed
EDIT: For some newer mac mini's, here are two other setpci commands for the WOL part, if the one above doesn't work:
setpci -s 00:03.0 0xa4.b=0
setpci -s 00:03.0 0x7b.b=19
Try one at a time, see which works.
Compiling and patching debian packages from source
A quick reference on how to compile Debian packages from source, and possibly patching them along the way.
VMware Server and Windows Firewall
VMware server uses port 902/TCP for remote connections. It is easy enough to allow outside connections to this port through the Windows Firewall interface in the Control Panel.
However, if you want to do it the "Windows Way (TM)" the trick is to add "vmware-authd.exe", found in the VMware Server folder in your installation directory, to the list of allowed programs. Then, even if you change which port number VMware should use, the Windows Firewall will allow it.
How to kill a process that uses too much CPU
Cleaning up my 'dump' directory, I found this aging script I got from somewhere, which will check the current CPU usage of a program and kill it if it uses too much. This is useful if you are for some reason forced to run buggy, closed source software which get stuck in endless loops when things go wrong. I've been there, it wasn't fun, but this thing solved it. Thank you, french christmas...
Disable .bash_history logging in bash, Debian
I hate the .bash_history file. It never contains what I want, screws up when using multiple sessions and generally contains junk. I like to disable the .bash_history file, while still keeping the ability to push the "up"-key to scroll through earlier commands in the same session.
The way to do this is to set $HISTFILE to /dev/null. Bash will now log all its history to a nice, black hole.
This can be done at the beginning of ~/.bashrc
... HISTFILE=/dev/null ...
There. Now I wont forget.
What separates a straight network cable from a crossover network cable
If you're connecting two machines with just a single network cable, like we did with parallell and serial cables back in the days, you've no doubt used a crossover cable. But why is this?
VESA console modes
Most linux kernels accept a "vga=" command line parameter, which will set the resolution to use during boot. This is a short list of video modes which can be used, given your kernel supports your video card well enough, and the video card can handle the resulution.
My computer has the correct resolution all the way from boot time, which makes text MUCH easier to read.
Disable bittorrent in Opera
Short reference, but I always forget.
Go here: opera:config#BitTorrent|Enable