Version 3
Archive for June, 2010
Reassign NIC Identifiers In Ubuntu
I swapped out some NICs recently on a few of my lab machines. These machines had a working install of Ubuntu Server 9.04. After installing the NICs and rebooting, ifconfig showed nothing but lo details. The first thing I did was ensured that the cards were seen by the OS by typing:
lspci | grep Ethernet
to which I received the output:
02:04.0 Ethernet controller: Intel Corporation 82557/8/9/0/1 Ethernet Pro 100 (rev 08) 02:05.0 Ethernet controller: Intel Corporation 82557/8/9/0/1 Ethernet Pro 100 (rev 08)
This was correct as my new NIC was a dual Intel NIC. From there I issued the command:
sudo mv /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules.old
I reboot the system and all NICs were re-assigned to the correct Eth* interface. Note that that the 70-persistent-net.rules.old will contain the old configuration should I choose this new NIC doesn’t work out for the system.
Differential Backup Using Rsync
Rsync is a well known tool for many who work in Linux regularly. Quite some time ago I put together a short script that uses Rsync and logs the result nicely. The first task Rsync performs is to send an incremental file list which contains any differences between the source and destination drive, then makes changes to the destination drive accordingly. Because of that last part extreme caution should be used when executing such a script because you run the risk of overwriting information on the destination drive you may not want removed. I have a dedicated drive for DV backups mounted in /media/dv-backup. To use this script just change the variables accordingly:
#!/bin/bash #dv backup script src=/media/dv dest=/media/dv-backup log=/var/log/backup/dv-backup.log echo "---" $date "-------------------" >> $log rsync -t -r -v --delete $src $dest >> $log echo "--------------- END ---------------" >> $log
I have my backups log in /var/log/backup/ and they merely append the file each time Rsync runs. I’m aware this is quite a simple script and could even be consolidated to one line. However, I found that breaking this up makes it easy to read and change. Also, who wants to remember every Rsync switch they want each time they want to perform a differential backup?
One quick change you could make to make it require less manually editing is replace the variables to take the terminal arguments. Such a revision is listed below:
src=$1 dest=$2 log=$3 echo "---" $date "-------------------" >> $log rsync -t -r -v --delete $src $dest >> $log echo "--------------- END ---------------" >> $log
Usage to achieve same result as original:
./backup.sh /media/dv /media/dv-backup /var/log/backup/dv-backup.log
Both script revisions are attached: backup.sh backup2.sh Use at your own risk.. don’t blame me if you incorrectly wipe a drive!