How do I change from ext3 to ext2?
Bruce Marshall
bmarsh
Mon May 17 11:44:19 PDT 2004
On Monday 10 February 2003 18:17 pm, Gerry Doris wrote:
> I want to do some disk rearranging and it would be really convenient
> if my partition were ext2 instead of ext3.
>
> I thought all I had to do was use tune2fs to convert the partitions to
> ext2 and then modify fstab to indicate the partitions were ext2.
> Well, that ended in a kernel panic with an error that the journal
> couldn't be found.
>
> What's the right way? Do I have to recompile the kernel? I'm using
> redhat 8.
>From Kurt Wall in a previous conversation:
> BTW, what *IS* the procedure to move from ext3 back to ext2. I knew
the
> procedure at one time but could never make it work. No matter what I
> tried, the partition always got mounted as ext3.
The tool I use is debugfs. It can be in interactive mode or in batch
mode. In batch mode, you use the -R option to specify a command to
execute:
root at luther:~# debugfs -R feature /dev/hda7
debugfs 1.27 (8-Mar-2002)
Filesystem features: has_journal filetype sparse_super
root at luther:~#
The feature "has_journal" indicates that it is an ext3 filesystem.
To clear this flag:
root at luther:~# debugfs -R "feature ^has_journal" -w /dev/hda7
debugfs 1.27 (8-Mar-2002)
Filesystem features: filetype sparse_super
root at luther:~#
The "^" in front of has_journal removes that flag. The command has to
be embedded in quotes to escape the spaces and to prevent debugfs from
interpreting ^has_journal as a stand-alone command. Next, unmount the
filesystem, edit /etc/fstab to mount the modified filesystem as ext2,
fsck the file system to clear the journal inode, then remount the
filesystem as ext2:
root at luther:~# umount /dev/hda7
root at luther:~# fsck /dev/hda7
fsck 1.27 (8-Mar-2002)
e2fsck 1.27 (8-Mar-2002)
Superblock doesn't have has_journal flag, but has ext3 journal inode.
Clear<y>? yes
/dev/hda7 was not cleanly unmounted, check forced.
Pass 1: Checking inodes, blocks, and sizes
Journal inode is not in use, but contains data. Clear<y>? yes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: -(516--8717)
Fix<y>? yes
Free blocks count wrong for group #0 (24050, counted=32252).
Fix<y>? yes
Free blocks count wrong (725080, counted=733282).
Fix<y>? yes
/dev/hda7: ***** FILE SYSTEM WAS MODIFIED *****
/dev/hda7: 11/373152 files (0.0% non-contiguous), 11724/745006 blocks
root at luther:~# mount -t ext2 /dev/hda7 /space1
root at luther:~# ls -l /space1
total 16
drwx------ 2 root root 16384 Dec 3 22:46 lost+found/
root at luther:~# mount
/dev/hda2 on / type ext3 (rw)
/dev/hda1 on /boot type ext3 (rw)
/dev/hda3 on /usr type ext3 (rw)
/dev/hda5 on /usr/local type ext3 (rw)
/dev/hda6 on /home type ext3 (rw)
/dev/hda8 on /space2 type ext3 (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
none on /proc type proc (rw)
/dev/hda7 on /space1 type ext2 (rw)
root at luther:~#
Voila. You're back to ext2. Hope this answers your question without
putting you to sleep.
--
+----------------------------------------------------------------------------+
+ Bruce S. Marshall bmarsh at bmarsh.com Bellaire, MI 02/10/03
19:36 +
+----------------------------------------------------------------------------+
"It IS as bad as you think, and they ARE out to get you."
More information about the Linux-users
mailing list