sys·ad·min·ol·o·gy [sis-ad-mih-nol-uh-jee]


  1. The scientific study of system administration and related phenomena.

Friday, 2 May 2014

Mounting Partitions Of Unknown Types

Its all about detectionMount is pretty intelligent when it comes to identifying the file system type of a given partition.

mount /dev/somedevice /mnt/somelocation

will generally do it.  If it cant figure it out for itself, then you will get an error similar to

mount: unknown filesystem type 'file system'

Sometimes though, we have to specify the file system manually using the -t flag

In the example that inspired this post, it was a ReiserFS partition over DRBD. Armed with that knowledge, of course we can do this:

mount -t reiserfs /dev/reiserfspartition /mnt/mount-point

But what if we want to script this or if its a backup script, and not all partitions are ReiserFS?

We can get a list of file systems supported by the host with the following:

So assuming we have our device and mount points already set:


for fs in $(grep -v nodev /proc/filesystems | awk -F"\t" '{print $2}'); 
   mount -t ${fs} /dev/vgxen/mcmail2_users_backup /mnt/lv_backup && echo "Mounted $device"; break;

This lists the supported file systems and then attempts to mount the device using each file system in turn. If it succeeds, it reports the success and then breaks out of the loop to prevent making any more attempts.

1 comment:

  1. Spend some money for your living rather than spending all on your cloths and living.It will help you live healthy and safe in a beautiful way. You can check double glazing prices for turn window with an agent and get your best.