Category Archives: Linux

Copy recursively files of one type

I needed to copy a bunch of JPGs from one folder structure to a mirror structure, but didn’t want to copy all the RAW files. Came across two examples. I tried the second (mainly because I understand it), and it worked nicely.

Example 1

Code:
#!/bin/bash
cd /home/images
find . -depth -type f -name '*.jpg' | cpio --pass-through \
 --preserve-modification-time \
 --make-directories --verbose /home/new_dir

Example 2

Code:
#!/bin/bash
cd /home/images
find . -type d -name '*' -exec mkdir -p /home/new_dir/{} \;
find . -type f -name '*.jpg' -exec cp {} /home/new_dir/{} \;

 

du –exclude

if I want to do a “du” command, and want to exclude certain folders (like /mnt in my case) I would run this while at root level, in the root folder.

#du -hs –exclude=’mnt’ *

DNS hostname recognition on LAN

For the longest time I couldn’t figure out why some machines on my LAN could be accessed by their server name, while others required IP address  to access.

Then I came across this post.

Mostly linux machines could not be access by their name (only IP address) because the name gets propagated using netbios. If Samba was installed and configured on the linux boxes, then it would work. But since I don’t have samba installed (nor do I want it) I have to manually configure the DNS entries in the Tomato formaware router. Adding the IP address, MAC Address and hostname to the Basic > Static DHCP setup will make the names pingable and accessible from any machine on the LAN.

xbmc revisit

I had a XBMC box made, but it would not play HD content, since it was not powerfull enough.

Then I switched to using the WD TV Live, but I really don’t like the interface…

So after some reading on the XBMC forums, I’ve found this post. Pretty much what I was looking for. A complete build that I could copy. Inexpensive at that!

I have the case, the ram, etc. All I need is the Mobo and a remote…

To be continued…

XenServer 5.5.0 and IDE drives

A few days ago I moved from runing a openSuSE DomU host to the Free XenServer 5.5.0 that Citrix is offering.

I had noticed that the VMs were running very slowly. Much slower then I remembered them running on the openSuSE DomU. So I did some tests, and it came down to the  fact that hdparm -tT /dev/sda was reporting about 1-2MB/sec for the buffered disk reads. This was taken at the console of the xenserver terminal, not on a VM.

After some research, I found out that the generic IDE drivers don’t allow for UDMA to be enabled. So I did the next best thing. I had a SATA drive of similar size in another machine, and swapped the two.

Now I get about 60MB/sec buffered disk reads. That’s what it should be. And from within a VM I get about 55MB/sec, but I don’t quite believe that. Will have to do some more extensive testing with bonnie++.

rtorrent config file

Since I decided to get a new motherboard to try to solve what I thought was a memory problem, I also decided (on a whim) to look into the rtorrent rc file.

Came across this site. Turns out the reason the xen server kept hanging may have been related to the max memory usage option… I’ve made some changes… we’ll see how they work.

I need to re-visit that site since there’s so much info on there, that I’d like to read and absorb. Continue reading