Thursday, January 31, 2008

smb.conf Ovewrites. It's not finished...

root> /etc/init.d/lighttpd.sh stop

which takes down lighttpd and the nasMaster.pl FCGI script.

Then edited /etc/init.d/network_servers.sh to disable start and stop of lighttpd at startup and shutdown.
Then manually updated /var/oxsemi/shares.inc to add a new share.
Then

root> reboot

When the machine comes back up, the file has not been overwritten. A-ha! One of the last things nasMaster.pl does before entering the CGI dispatch loop is invoke Service::Shares->createDefault() but all this does, as far as I can see is delete and recreate the [PUBLIC] share.

Service::Shares also defines a deleteAllExternal() method which would certainly hae the same effect I'm seeing, but where is it called...?

I feel like Columbo. I know who did it and now just need to badger them into making a mistake to get the proof I need.

smb.conf Overwrites

Last night.

As previously mentioned I plugged a LaCie external USB hard disk into the MBW and it appeared via hotplug. Then created a samba share for it using the Drive Managment tool in the MBW web-admin console.

But after rebooting, the external drive is gone again. I mean, how annoying is that!?

The drive management tool writes its updates to a shares.inc file which is included by the main smb.conf file. (All samba config is in the /var/oxsemi directory). On rebooting, both smb.conf and shares.inc have last update times set during boot up (or possibly shutdown? To check!). The shares.inc file has been overwritten, keeps all the shares on /shares/internal but is missing my lovely new backups share!?

Results so far
  1. I don't think Samba overwrites the files as a matter of course. It may alter file permissions for security when nmbd or smbd starts up but not change the contents?
  2. there are some "tidy up external shares" perl scripts as part of the usr/www/lib area which is where the web admin tools live. But disabling lighttpd on start up (which should prevent any .pl scripts from running) makes no difference. (Maybe it's a shutdown script as mentioned above?) Even then the script is meant to check if the mount point is listed in /etc/mtab, which it is.
Cock-a-doodle doo!

Tuesday, January 29, 2008

Preparation

Some tidying up and moving things around on the MyBook World (henceforth referred to as MBW).

The MBW has a USB socket on the back for connecting external drives to, so my 250Gb LaCie is now plugged in to make it always available. This will be used for windows backups. (Currently using Cobian but getting errors when using compression... may have to try something else).

The USB drive was automatically recognised and mounted under /shares/external, but with no write permission as it was currently formatted as NTFS.

Unmount the drive, which for me appears as /dev/sdb1

root> umount /dev/sdb1

Then use fdisk to reformat the drive

root> fdisk /dev/sdb1
Command (m for help): d
Command (m for help): n

Create a single primary partition

Command (m for help): w


Then create an ext3 file system on the partition

root> /sbin/mkfs.ext3 /dev/sdb1

Reboot and the drive should be mounted under /shares/external as a writable filesystem.

Use the WD Shared Storage Manager to create a new public share called BACKUPS. The only person with write permission will be me as I'm the only PC user running the backup software.

Gotcha: I tried to use fdisk to change the partition's System ID. This was 83 (Linux) by default. I tried to make it fd (Linux raid auto) to match the MBW's internal disk. This continually failed with an illegal argument error. I eventually realised that Linux raid auto is only valid for a disk attached via a RAID controller which the internal disk must be. The USB disk, of course, isn't. Half an hour of my life I'll never get back.


Monday, January 28, 2008

A New Hope

Feel free to read if you wish, or ignore if you don't.

I spend a fair bit of spare time fiddling about with programming and Linux stuff. Taking the "if it ain't broke then you're not trying hard enough" approach to many things. Typically I get something working. Once. Then re-invent the wheel six months or a year later doing it again. I need to keep a note of what I've done, preferably somewhere I can check from anywhere, and is searchable, indexable and convenient.

And free.

So this is for me, but if a google search brings you here while you're searching for the solution to a particularly thorny problem then make yourself at home, I hope something might be of use.

Currently working on: