If you need to constantly move databases around between different MySQL servers the quickest way to do it is to dump the contents into a SQL file on the command line then GZIP it and send it to another server via SCP or FTP.
To export a database use the following command:
mysqldump -u username -p dbname > dbname.sql
To import it on the destination server use the following command:
mysql -u username -p dbname < dbname.sql
If you get this error when trying to mdadm --add a drive back into a mdadm array, then it's probably because the drive you are trying to add has been partitioned incorrectly. To confirm that this is the cause run fdisk -l on all the drives already in the array.
You will notice that all the drives in the array will have the same results for the second line of output:
64 heads, 32 sectors/track, 476940 cylinders
Note those details for the drives already in the array.
Now run the fdisk -l command again on the drive you are trying to add. The results will most likely be different. To resolve this, run fdisk on the drive you are trying to add to the array. Remove all partitions that you might have created before.
In expert mode (press x) you have the following options:
Expert command (m for help): m
Command action
b move beginning of data in a partition
c change number of cylinders
d print the raw data in the partition table
e list extended partitions
f fix partition order
g create an IRIX (SGI) partition table
h change number of heads
i change the disk identifier
m print this menu
p print the partition table
q quit without saving changes
r return to main menu
s change number of sectors/track
v verify the partition table
w write table to disk and exit
You'll need to use options c, h, and s to match up the settings with the existing drives. Once you've done this recreate a partition on the new drive and write the partition table to the disk and exit. Now you should be able to add the drive back into the array.
I wanted to create a second Aperture Vault on a hfsplus volume, but hosted on my network. I could do this using Disk Utility, but due to some complications in the way my Linux Samba server is setup I needed to create the disk images on my Linux server directly.
In this case I am creating a 160GB volume named 'APV.dmg' to match the size of the external firewire drive I use with Aperture.
The following command will create the empty disk image:
dd if=/dev/zero of=APV.dmg bs=1M count=163840
Then to format it as a hfsplus volume:
mkfs.hfsplus -v 'Aperture Vault' APV.dmg
I test copied some files over my LAN (gigE) to this volume when it was mounted on my Mac, and the speeds are equivalent to an external firewire drive. That is, they are limited by the 5400rpm 2.5" SATA drive in my laptop rather than any other component.
I recently created some .dmg files using Disk Utility on my Mac system. I placed these files on my Linux server which hosts them to the network via Samba. The advantage of mounting the .dmg files is that I can use a native Mac file system, which means I can store Aperture vaults on there as well as have these locations indexed/journalised by Spotlight.
I wanted to ensure that I would be able to read the data on these disk images if I was Mac-Less, but most guides indicated I should use the following command:
mount -t hfs -o loop /directory/location_of_dmg.dmg /mnt/mountpoint
This gave errors about bad filesystem type...
It seems later versions of Mac OSX use a filesystem recognised by Linux as "hfsplus", so the following command is required:
mount -t hfsplus -o loop /directory/location_of_dmg.dmg /mnt/mountpoint
This way in case of some disaster which leaves me with no Mac system, I can still retrieve/recover data from the Mac disk images!