From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Dilger Subject: Re: filesystem differentiation Date: Sat, 15 Mar 2008 07:24:03 +0800 Message-ID: <20080314232403.GI3542@webber.adilger.int> References: <804dabb00803140917o2abebd2dh12c77b21a48094c4@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7BIT Cc: kernelnewbies , linux-fsdevel@vger.kernel.org To: Peter Teoh Return-path: Received: from sca-es-mail-1.Sun.COM ([192.18.43.132]:45988 "EHLO sca-es-mail-1.sun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753433AbYCNXYW (ORCPT ); Fri, 14 Mar 2008 19:24:22 -0400 Received: from fe-sfbay-10.sun.com ([192.18.43.129]) by sca-es-mail-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id m2ENOL7J019528 for ; Fri, 14 Mar 2008 16:24:21 -0700 (PDT) Received: from conversion-daemon.fe-sfbay-10.sun.com by fe-sfbay-10.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0JXQ00M01U7PQQ00@fe-sfbay-10.sun.com> (original mail from adilger@sun.com) for linux-fsdevel@vger.kernel.org; Fri, 14 Mar 2008 16:24:21 -0700 (PDT) In-reply-to: <804dabb00803140917o2abebd2dh12c77b21a48094c4@mail.gmail.com> Content-disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mar 15, 2008 00:17 +0800, Peter Teoh wrote: > given different harddisk partition, does anyone knows how to > differentiate one partition from another? > > at the kernel source level, which is the constant/variable for this? > > Is it EXT3_XATTR_MAGIC? (but EXT2_XATTR_MAGIC have the same value as > ext3, so betw the two they are not distinguisable?) > (or REISERFS_XATTR_MAGIC etc) Read the file (1) and blkid (8) man pages. These tools understand a lot of different magic numbers for filesystems: # file -s /dev/sda1 /dev/sda1: Linux rev 1.0 ext3 filesystem data (needs journal recovery) (large files) # blkid /dev/sda1 /dev/sda1: LABEL="/boot" UUID="1fe1d719-1a8c-45a0-969a-cba8b101cc57" SEC_TYPE="ext2" TYPE="ext3" > So I supposed if I were to create my > new filesystem, then just create a new /random value from this? Pretty much, yes. You should also add a LABEL and UUID field so that one instance of the filesystem can be distinguished from another. A better goal (IMHO) than creating your own new filesystem is to help out some existing filesystem like ext4 or btrfs. Cheers, Andreas -- Andreas Dilger Sr. Staff Engineer, Lustre Group Sun Microsystems of Canada, Inc.