Monday, August 11, 2008

How to backup Linux to FAT32 External Drives

There is very good tutorial on this issue, however, i wanted to add a bit more. How to backup Linux to FAT32 External Drives | WickedBlog
The backup process sounds pretty easy, but indeed, there are heaps problems when you actually working on it.

I am a windows user, and nowadays, most product are targeting windows user.  I developed the backup utility for the SMEServer (e-smith server) and First of all,
the priority is that things can be extract in Windows.  Obviously , NTFS is not a good option cause it is not supported in SMEServer.  So Fat32 was chosen and I didn't realise the file size limit of 4G until some time had passed and all my backups are smaller than 4G.

Let's begin with backup first.

tar -czf /media/DRIVENAME/BACKUPNAME.tgz /home

This is the real simple solution to backup one folder, and of course, we have more to backup.  So, we introduce the following one:

'tar -cz --files-from '+ FILELIST_TAR + ' > ' + TAR_OUTPUT+'.tgz'

NOTE that I now read files from a list, and this is recommended to do only when programming.

Finally, we need to split it

'tar -cz - --files-from '+ FILELIST_TAR + ' |  split -b 3880m - ' + TAR_OUTPUT+'.tgz'

Re-constitute properly with this customized restore command:

cat /media/DRIVENAME/BACKUPNAME.tgz.* | tar -zxf -

And of course, I didn't forget the windows user, you can re-constitute the files like this:
copy /b BACKUPNAME.tgz.* ALL_IN_ONE.tgz /b

Enjoy

No comments: