I recently discovered the awesome GNU Stow application (works on unix-like systems like GNU/Linux or Mac OSX). Stow is a symlink manager, that allows you to easily deploy and remove files to or from a directory.

Setup

Let’s say you have some configuration files in your home directory (eg: .bashrc, .vimrc and a config directory .vim) and you want to have them in git to be able to track your changes and such. It’s not a really good idea to make your whole home directory a git repo. That’s where Stow comes in. Just create a configuration directory, for instance ‘dotfiles’, and create a subdirectory for every app you have configs for. Then place the appropriate files into the right subdirectory, like this:

/home
    /{user}
        /dotfiles
            /vim
                .vimrc
                /.vim
                    ...
            /bash
                .bashrc

You can now make the dotfiles directory a git repository, and keep your dotfiles safe in git. But they’re not yet in the right place, so we’ll ask our symlink manager to fix that for us.

Create symlinks

  1. cd to the dotfiles directory
  2. You can make Stow symlink the files to your homedir like so:
    stow {package}
    where you replace {package} with the name of the subdirectory you created earlier.
  3. If you now want to remove a certain package’s config files, just do this:
    stow --delete {package}

How to install Stow

On Mac OSX

Use Homebrew:
brew install stow

On GNU/Linux

Install stow using your favorite package manager, e.g.:
apt-get install stow

That’s it!

This is a difficult issue for some new Mac OSX users. They have their external HD drives, formatted in NTFS, and when they plug it into their mac, they find they don’t have write access to the drive. You can easily solve this without having to install third party software. (at your own risk)

1. Open a terminal, and type this
diskutil info /Volumes/**THE NAME OF YOUR DRIVE**
where you change **THE NAME OF YOUR DRIVE** to the actual name of your HD drive (or usb stick…)

2. You will get a whole list of info on that drive. Look for “Volume UUID”, and copy the corresponding value.

3. backup the file /etc/fstab if it exists on your system by typing
sudo cp /etc/fstab /etc/fstab.backup

4. edit the fstab file with ‘nano’
sudo nano /etc/fstab

5. insert UUID= and then the value you copied from step 2. after that press space, and type none ntfs rw you must see something like this:
UUID=123-456-789 none ntfs rw

6. save, exit nano, reboot system.
ctrl+o (=save)
ctrl+x (=quit nano)

now check if it works… and it will
that’s it!

regards
Toon

All too often, when you need to download a big file that somebody shared with you over a free file host like rapidshare, you find that they used HJSplit (Windows / Linux) or Split&Concat (Mac Equivalent) to split the big file in smaller parts so they can bypass the file size limit on those free hosts.

It was a pain for me to deal with them, because i refused to install one of mentionned and not-so-professional-looking, closed source programs to ‘concat’ the files again.

Now i found out that if you’re using GNU/Linux or Mac OSX you already have the tools to split and concat right under the hood of your operating system!

to split a large file called ‘bigfile.mkv’ into 100MB parts, type this in the terminal:
split -b 100m -d -a 3 bigfile.mkv output.mkv.
* -b 100m: 100MB parts
* -d: use numeric suffixes (doesn’t work on Mac OSX)
* -a 3: use 3 suffix characters
* output.mkv. : output filename. don’t forget the trailing dot (.)
-> in Mac OSX, the -d option doesn’t work, so the split command only provides .aaa, .aab, etc. names.
-> you’ll need to rename all files to use .001 instead of .000 or .aaa extensions as the first archive file (and increasing names for the other files) to be compatible with HJSplit.

to concat bigfile.mkv.001, bigfile.mkv.002, and bigfile.mkv.003 to the original file, type this in the terminal:
cat bigfile.mkv.001 bigfile.mkv.002 bigfile.mkv.003 > bigfile.mkv
– make sure you respect the order of files! (first 001, then 002, etc…)

that’s it!
Toon

Some time ago I bought a new harddisk, and I wanted to be able to use it on my Mac, on my Linux box and on my brother’s Windows computer. So I started looking for the right filesystem to format the drive to. Default Max OSX HD formatting is HFS+ with journaling enabled, but that doesn’t work on Windows. Default Windows formatting is NTFS, but on a mac, you don’t have write access to the disk. The default on linux is ext3 or ext4 which are both not easy to access on Windows or Mac OSX. After some thinking, I found that USB sticks work flawlessly on these three operating systems. So I decided to format my external HD the same way a USB stick is formatted, being the old FAT32. The problem is that if you’re on a Mac or on a Windows computer, there is no way to make that happen for large drives, so i had to move to my Ubuntu box.

For this action there is a perfect gnome tool available, called GParted. Install it using your favourite software manager. Then connect your external HD to your computer. (make sure you have a backup available if there are files on it)
1 – Open GParted (System > Administration > GParted/Partition Editor).

2 – In GParted you can now select your device (GParted > Devices > yourdevice). You then get a graphical representation of the formatting of that device.

3 – Create a partition table (Device > Create Partition Table) and delete the partitions you don’t need anymore.

4 – Create a new partition, make it as big as your harddisk, choose fat32/vfat as filesystem, and give it a label.

5 – Now check if everything looks ok, and press the ok button to apply changes.

6 – Done! You can now mount your new partition.

Saved by the mighty Ubuntu GNU/Linux once more!

Toon

PS: note that there’s a 4GB limitation on file size when using FAT32.
PS2: the labels on your partitions will be uppercase. If you want mixed-case labels, like ‘LaCie’ or something, you can use this command instead of step 4:
sudo mkfs.msdos -n LaCie /dev/sdb1
in which you substitute ‘LaCie’ with the label you want, and ‘sdb1’ with the right partition name.

Backup with Rsync

February 25, 2010

Everyone needs to make backups. Some people copy their most important files to an external hard disk or DVD, others use automated software to do the job for them. Many Mac OSX users use Time Machine, Apple’s backup application. I think i don’t have enough control when i use it. So i started looking for a program that did what i wanted it to do, make incremental backups from folders that i chose, and have the option to exclude files or folders from the backup.

Rsync, a command line (cli) program that’s installed by default on almost all UNIX based operating systems (so also Mac OSX and a whole lot of GNU/Linux distro’s), does the job quite good for me.

rsync -avzru /Volumes/LACIE/ /Volumes/LaCie\ 1 --exclude "/Applications/**" --exclude ".*" --exclude ".*/" --exclude ".*/**"

that’s what i type in the terminal.

  • rsync is the program.
  • -avzru means ‘archive’, ‘verbose’ (more output to the command line), ‘compress’ (use compression to decrease traffic if you use rsync over a network), ‘recursive’ (go into all folders), ‘update’ (don’t overwrite newer files)
  • /Volumes/LACIE/ this is the source external hard disk (notice the “/” at the end!)
  • /Volumes/LaCie\ 1 this is the destination external hard disk. It’s called ‘LaCie 1’, and the backslash is there to see the space as part of the path. (notice that there is no “/” at the end)
  • –exclude “/Applications/**” here i exclude the folder ‘Applications’ from the backup
  • –exclude “.*” –exclude “.*/” –exclude “.*/**” also exclude all hidden files and folders

that’s it 🙂

Toon