How do activate an automatic update for a Debian based distribution?
December 31, 2007
I’m running many VE’s (virtual environments) on some OpenVZ servers. A Linux distribution within the VE has no own kernel and I can always access a VE from the hardware node so I thought it is save to update them automatically every day, but they should not do the update at the same time (more than one runs on the same physical server) and if an error occurs I would like to get an email. Sounds not that easy, but it is. Just do following:
# apt-get -y install cron-apt
# cat > /etc/cron-apt/action.d/9-dist-upgrade
dist-upgrade -y -V -u -o Dpkg::Options::=--force-confold
and you’re done. If you configured the root mail alias to the right address you get a mail if something didn’t work. cron-apt waits a random amount of time when started by cron before it starts calling apt-get – so we are done. I’ve this setup running now for some years without ever having a problem with it. I use it for Debian Sarge and Etch and Ubuntu Dapper 6.06 LTS.
How to read a RAID1 hard disk if you can’t use the RAID Controller?
December 30, 2007
I had following problem:
An 3ware RAID controller got destroyed after a power surge and I needed to read the data on the RAID without waiting for a replacement controller. I therefore attached one of the hard disks via an USB adapter (PATA/SATA to USB2) to my notebook. The problem now is that a RAID Controller uses some blocks at the beginning of the disk for itself, this leads to the problem that the partition table is not found by the Linux kernel.
Solution:
I used LDE (The Linux Disk Editor) to find out how many blocks are used by the RAID controller. My 3ware controller used 0x200 = 512 blocks with 1024 byte = 524288 bytes offset. I therefore created an loop back device with this offset:
# losetup -o 524288 /dev/loop0 /dev/sdb
and I checked if the partition table is readable via:
# fdisk -l /dev/loop/0
Disk /dev/loop/0: 160.0 GB, 160041361408 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot    Start     End    Blocks  Id  System
/dev/loop/0p1 Â Â Â Â Â Â Â 1 Â Â Â Â 249 Â Â 2000061 Â 82 Â Linux swap /
Solaris
/dev/loop/0p2 Â * Â Â Â Â 250 Â Â Â Â 1494 Â Â 10000462+ Â 83 Â Linux
/dev/loop/0p3 Â Â Â Â Â Â 1495 Â Â Â 19457 Â 144287797+ Â 83 Â Linux
Looks good, but mounting didn’t work directly but I didn’t have the time to look into more detail (maybe udev didn’t created the /dev entries), it was important to get the data of the disks as fast as possible. So I just removed the loop back device with
# losetup -d /dev/loop0
and started to do some math. The swap partition was of no need, I needed only the two ext3 partitions. I calculated the offset of the first of these partitions this way: 249 units with each 8225280 bytes and of cource the RAID controller offset:
249*8225280 + 524288 = 2048619008
with this I did the mounting like this:
# losetup -o 2048619008 /dev/loop0 /dev/sdb
# mount -r /dev/loop0 /tmp/1
and for the second ext3 partition this.
1494*8225280 + 524288 = 12289092608
# losetup -o 12289092608 /dev/loop1 /dev/sdb
# mount -r /dev/loop1 /tmp/2/
I hope this helps someone in a similar situation as I was.
Goals and purpose of this blog
This blog is about Linux (and open source in general), IT security, and tips and tricks and if possible some off topic stuff. I define Linux in this case as the whole ecosystem which is built around the Linux kernel. Still to fuzzy?
In my spare time I often write small scripts which help me to save time. These are often small scripts, but even the medium ones (at least in the beginning) are too small for a dedicated project page (e.g. on sourceforge) like I did for ignis or cdemu. I specially don’t know if anyone is
interested in them and/or what additional features and functionality are needed. In this blog I can just post them and attach the source to post and look if they are interesting for others.
In my daily life I come also across problems where I’m not able to find HowTos or good solutions by simple searching in Google. Maybe it’s because I’m not entering the correct search terms ;-). In this cases I will post the problem and solution in this blog so Google will hopefully find it for others who search with the same terms I do.
This blog should also be the place which links my various online stuff together, and provide it hence with a higher Page Range in Google and makes all of my stuff easier findable for others.
The above topics are mostly about making stuff, which I would have also done without this blog, easier accessible for others, which will be the major part of the blog’s content (at least in the beginning), the following topics are more likely to generate content explicitly for this blog.
IT security interested me since my time at the university – and my master thesis with the topic “Analysis and design of a SIM based authentication solution for WLAN” was also in this field. As you see I’ve quite an interest in this field, and I therefore thought it should be fun to blog about it. There won’t be many articles as I’m not thinking about just linking to other information and saying. “Yeah they’re rightâ€
Powered by WordPress
Entries and comments feeds.
Valid XHTML and CSS.
25 queries. 0.041 seconds.