Search Content Through Tags
bands Berlin debian disk exim flickr geek Germany gigs Hard disk Holiday images internet Linux load balancing mail server mta Music Photography rant servers solaris spammers squid storage stuff unix Vacation vps warehouseexpress wordpress
removing blank newlines using sed.
Most people won’t find this paticularly useful, but as I’m prone to forget things:
sed -e '/^$/d'
will delete blank newlines from whatever it’s input is.
Tags: geek, Linux, stuffthe number of servers you run …
Well reading popeys blog entry on how many servers he has, and what he uses them for made me feel a bit better than I did previously, about running more than one server of my own for personal use. I only have three servers, and a workstation and a laptop; maybe I don’t waste as much electricity as I thought I did
- etch.thefraggle.com - Debian etch, xen vps from bitfolk; general webserver for www.thefraggle.com, and master mail server.
- sarge.thefraggle.com - Debian etch, xen vps from bitfolk; run’s IRCd’s for blitzed.org and nixhelp.org and tertiary mail exchanger.
- beastie.thefraggle.com - FreeBSD-6.2-stable on an old p2 400mhz 128mb ram; used to run an ircd for nixhelp, and thefraggle.com website, but now has been retired to being a development machine and tertiary mail exchanger.
- laptop - centrino duo 1.7ghz 1gb ram; work laptop with winxp / debian etch for work stuff
There’s actually another box there, my dads p4 3ghz, that I have pretty much nicked off him for day to day internetting :). I suppose the fact that I have three servers kind of means I am pretty geeky?
Would be interesting if anyone reading this also commented with what they use :).
Tags: debian, geek, Linux, servers, vpssomeone shoot scsi disks, plz
So restarting the server mentioned yesterday with replaced disk was ok, all I had to do was tell grub-install to recheck for bios devices, and to see the second scsi device, and then install the mbr to it:
grub-install --recheck
grub-install "(hd1)"
take the disk out, put the new disk in slot 0 and hey presto!
The most annoying thing is that I think there is likley a controller problem, so all this work may have been for little gain!!
Tags: geek, Linux, unixcat can have some handy features too.
Another nifty thing I figured out a while ago, whilst having to upload a script written by one of the guys we support, in a windows editor, was how to check quickley and easily with cat(1)whether it had silly windows CR/LF’s :
cat -ev /path/to/file
Would output something like the following if the file had silly line endings…
This is some text written in windaz^M$ And another line edited in windaz, woo^M$
cat suffixes the end of line with a $ and shows any special characters that have been inserted, in our case here ^M is the windows special character for new line, so all you need to do is remove that, which is again pretty easy:
sed -i.bak -sed -e "s/r//g" /path/to/file
Should remove the windaz file endings from the file, copying the file with a .bak suffi as a backup.
Tags: geek, Linux, unixsfdisk is quite handy
So today I had to basically clone a hard disk from a failing disk, to a new disk Sun had sent for one of the v20z’s at work… Haven’t not had to mess about with partition tables and other such things outside of the installer in linux for some time (last time I did this kind of messing about was with freebsd which uses slices->partitions, unlike linux and it’s mad idea of partitions and extended partitions), so I had to take stock for a short while while I figured out the best way to go ahead. Here’s what I started with :
/dev/sda - main scsi hard disk at scsi id 0
/dev/sdb - new replacement disk at scsi id 1
Saving and restorring the partition table to the sdb was as easy as:
sfdisk -d /dev/sda > /tmp/sda-parttable.out
and then:
cat /tmp/sda-parttable.out | sdisk /dev/sdb
I’d never realised sfdisk could do easy things like that, which saved me some time having to input partition boundries by hand
What next was a bit of a pain was getting files over to the new filesystems (obviously once I had created new filesystems on them and mounted them somewhere easy to use - /mnt/newroot). I had looked at possibly using cpio to do this, and considered dd.
It seemed the best in the end, to create tar archives of the data, so that if I made a mess of the new disk I could at least quickly extract the backups again without too much faff, to do this I simply archived up each partition using something along the lines of:
tar --preserve --one-file-system -vcf /mnt/newroot/root.tar /
this archived the root into /mnt/newroot/root.tar, but diddn’t traverse into new directories, –one-file-system is a pretty handy feature of tar and I’m sure it’ll come in useful again sometime in the future. Tomorrow I’ll update with how easy it was to install the new mbr to sdb and how removing the origional disk and moving sdb to sda’s slot, goes ![]()