Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have an ext3 partition so when I do this:

mount /dev/blah /mnt/blah

it is mounted automatically as ext3. I can get it to mount as ext4 by running

mount -t ext4 /dev/blah /mnt/blah

and it works. I presume the partition is somehow tagged as being ext3. Is it possible to change that to ext4 so that:

mount /dev/blah /mnt/blah

will mount it as ext4. This is for an experiment. I want to do it without enabling the new features in ext4 so I can go back to ext3.

share|improve this question
    
Which distro? mount -V? Did you get the "You must specify the filesystem type" message when mouting without -t? cat /proc/filesystems? –  quanta Feb 27 '13 at 16:15

3 Answers 3

up vote 3 down vote accepted

If at creation time the file system did not use, or explicitly disabled, the ext4 extensions (like uninit_bg and flex_bg), the filesystem will be actually ext3 (if it has journal) or ext2(if it has not ext3 or ext4 features).

You can enable the ext4 features with tune2fs -O.

ext4 man page:

If the -O option is used to explicitly add or remove filesystem options that should be set in the newly created filesystem, the resulting filesystem may not be supported by the requested fs-type. (e.g., "mke2fs -t ext3 -O extents /dev/sdXX" will create a filesystem that is not supported by the ext3 implementation as found in the Linux kernel; and "mke2fs -t ext3 -O ^has_journal /dev/hdXX" will create a filesystem that does not have a journal and hence will not be supported by the ext3 filesystem code in the Linux kernel.)

tune2fs man page:

-O [^]feature[,...]-O [^]feature[,...]

Enabling certain filesystem features may prevent the filesystem from being mounted by kernels which do not support those features. In particular the uninit_bg and flex_bg features are only supported by the ext4 filesystem.

share|improve this answer
    
For the record, just adding extents caused the partition to be recognized as ext4 at boot time. Enabling uninit_bg made it recognizable as ext4 by mount, but at boot time it would try to mount it as ext3 and failed. I'm not sure if this is true for every machine out there. –  J. Pablo Fernández Feb 28 '13 at 12:26

man mount:

If no -t option is given, or if the auto type is specified, mount will try to guess the desired type. Mount uses the blkid library for guessing the filesystem type; if that does not turn up anything that looks familiar, mount will try to read the file /etc/filesystems, or, if that does not exist, /proc/filesystems. All of the filesystem types listed there will be tried, except for those that are labeled "nodev" (e.g., devpts, proc and nfs). If /etc/filesystems ends in a line with a single * only, mount will read /proc/filesystems afterwards.

# mount -V
mount from util-linux-ng 2.17.2 (with libblkid and selinux support)

Besides the blk_id:

# blkid -o value -s TYPE /dev/sdb1
ext4

there are some other ways to determine the filesystem of an unmounted partition:

# file -s /dev/sdb1 
/dev/sdb1: Linux rev 1.0 ext4 filesystem data (extents) (large files) (huge files)

# fsck -N /dev/sdb1
fsck from util-linux-ng 2.17.2
[/sbin/fsck.ext4 (1) -- /dev/sdb1] fsck.ext4 /dev/sdb1 

# parted /dev/sdb1 print
Model: Unknown (unknown)
Disk /dev/sdb1: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End    Size   File system  Flags
 1      0.00B  107GB  107GB  ext4
share|improve this answer

mount /dev/blah /mnt/blah works only with an fstab entry, doesn't it? So change the fstab entry to ext4 and that's it.

What you probably mean is the behaviour of

mount -t auto /dev/blah /mnt/blah

I don't know where the order in which ext3 and ext4 are checked is defined. I believe there is no mark in the FS itself: "Prefer to be mounted as ext4." Something similar to a mark are non backward compatible ext4 features which are set in the superblock. These would prevent the FS from being mounted as ext3 but that's not what you want.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.