Coredump

Work, play, and everything in-between.

Archive for June 13th, 2004

Mounting a shared disk

with 2 comments

This has probably been written elsewhere — and better. Still, I have to write this down so that later on, I could use this for reference. Besides, this works FOR me.

Linux can read (and write to, given the proper permissions) to native Windows partitions. Well, VFAT at least. NTFS read-write is in alpha, I think. I have installed a patch to read my NTFS partition in FC1, but I’m more prudent regarding the write stuff. There is also a big issue of why Red Hat — and consequently, their community project Fedora Core — doesn’t support NTFS natively. But that’s another story.

My box, for example, has two harddisks: a Seagate 40GB and a Maxtor 2GB (it’s an old one from way back 1997, still usable though). The Seagate is partitioned into one big wallop of WinXP NTFS occupying 30GB, and Linux partitions sharing the rest of the meager 10GB. Linux doesn’t complain for the allocation. In fact, it could do with about half of that. Try that with Windows. (On a side note: I keep saying “Try this, try that, with Windows” just to illustrate the glaring and obvious limitations of that OS line.)

The Maxtor is FAT32 containing files that I share between my two OS. My /etc/fstab entries for this is:

/dev/hdb1 /mnt/win_fat32 vfat defaults 0 0

Problem is, the /mnt/win_fat32 is mounted as root, so unless I sudo all my writes to that mount, I can only read it. Bad, since I also place the shared Thunderbird Mail directory there. (See previous post.)

So I rethought my strategy:

  1. Unmount the FAT32 partition.
  2. Create a new directory under mnt.
    # mkdir /mnt/win_fat32

    # chown -R iandexter:users /mnt/win_fat32

    What I did after creating the directory was change its ownership to mine so that I have read-write permissions to it.

  3. Edit /etc/fstab.
    # vi /etc/fstab

    /dev/hdb1 /mnt/win_fat32 vfat rw,noauto 0 0

    I changed the options so that the FAT32 partition is not mounted at startup but with read-write permissions.

  4. Add a command to mount FAT32 when I log in.
    $ vi ~/.bash_profile

    mount /mnt/win_fat32

    YMMV: for Red Hat and Fedora, bash looks at .profile, .bash_profile, .bash_login, and .login consecutively at login. RTFM.

  5. Add a command to unmount FAT32 when I log off.
    $ vi ~/.bash_logout

    umount /mnt/win_fat32

    Again, YMMV, RTFM.

To test this, try logging in, write to /mnt/win_fat32, log out, log in as another user to see if the mount was cleanly unmounted.

Written by Ian Dexter

June 13th, 2004 at 1:56 pm

Posted in Play

Sharing emails between Linux and Windows, the Thunderbird way

without comments

Having two operating systems is a good way of having the best of both worlds. Well, there are hardly “best-ofs” in Windows, but since people here at home are all WinXP users, I can’t get rid of that just yet. Besides, I do some of my, uhm, design work on WinXP, so it stays.

But I digress: yes, having two OS is great, but it can be even greater if one can share email from the same accounts between the two OS. Gone are the days when I use Outlook for WinXP and Mutt for Linux. (I still use Mutt at work, though.) Presenting Mozilla Thunderbird, an email and newsgroup client from the developers of Firefox. It boasts of a clean interface, powerful anti-spam features and a host of extensions, making it have virtually unlimited features. Plus, it’s open source.

I’ve been using it for a week now for both Windows and Linux, making a few changes in the preferences by hand — try that with Outlook (you CAN’T). I have two office accounts: one for office correspondence and the other for technical mailing lists. I like the way Thunderbird handles threading and reply nestings, specially for mailing lists. I use these features as well for office mail to track progress on back-and-forth communications and transactions via email. Since we have a POP3 server, I can also download email at home, and Thunderbird makes it easier for me to do that.

Problem is, I have tweaked Thunderbird on the Linux more to my liking, while leaving the Windows version bare. And, if I download mail on the Linux part, I don’t like doing it again on the Windows part by leaving the messages on the server and going through the download process again. Fortunately, Thunderbird put out a tutorial on sharing mail between Linux and Windows versions.

I could not possibly go through the process outlined in the tutorial simply because I’ve rigged my Linux profile to my liking and I’m too lazy to go reconfiguring it. So: I rolled my own Thunderbird-email-sharing strategy.

The prerequisites are:

  1. Of course, running Thunderbird versions for Linux and Windows.
  2. A FAT32 partition on which the user has read-write permissions. (I’ve also come up with a way of doing this, but that’s for another post.)

This assumes that you have set up your Thunderbird profile, along with message filters, accounts, folders, etc., in Linux. You will start a new profile in Windows.

Here we go:

  1. Create a new Windows profile.

    Start with the Windows version. Run thunderbird.exe -p to bring up the profile manager. You can move the existing profile to the shared FAT32 partition, but it’s not covered here. Create a new profile and save it in the FAT32 partition (D:\). For our purposes, let’s call that profile “thunderbird”, which will be stored at D:\thunderbird\a1b2c3d.slt (where a1b2c3d is the profile generated by Thunderbird). Leave the profile as is.

  2. Copy the Linux profile’s Mail directory to that of the Windows’.

    Reboot to Linux. Copy all the contents of your profile’s Mail directory to Windows profile:

    cp -R ~/.thunderbird/default/e5f6g7h.slt/Mail/* /mnt/win/thunderbird/a1b2c3d.slt/Mail/

    Where mnt/win is the FAT32 partition. Again, make sure you have read-write access to it.

  3. Modify the Linux prefs.js.

    Edit ~/.thunderbird/default/e5f6g7h.slt/prefs.js in your favorite editor (still the trusty vim for me).

    Look for the following lines:

    user_pref("mail.root.none", "~/.thunderbird/default/e5f6g7h.slt/Mail");
    user_pref("mail.root.pop3", "~/.thunderbird/default/e5f6g7h.slt/Mail");
    user_pref("mail.server.server1.directory", "~/.thunderbird/default/e5f6g7h.slt/Mail/pop.myisp.com");

    Change the above to:

    user_pref("mail.root.none", "/mnt/win/thunderbird/a1b2c3d.slt/Mail");
    user_pref("mail.root.pop3", "/mnt/win/thunderbird/a1b2c3d.slt/Mail");
    user_pref("mail.server.server1.directory", "/mnt/win/thunderbird/a1b2c3d.slt/Mail/pop.myisp.com");

    Note that you may have multiple mail.server.serverX.directory lines so change those as well.

    Finally, delete lines containing “[ProfD]” as these are relative paths generated automatically.

That should be it. Verify that your setup is working by downloading mail in your Linux, save a draft mail, then reboot to Windows to see if they’re there as well. You may want to modify your preferences in Windows, too. (I’m probably gonna do that later on.)

Written by Ian Dexter

June 13th, 2004 at 3:42 am

Posted in Play