-
DEBIAN > convertir son systeme de fichiers ext3 en ext4
Et le tout, sans perte de données !!!
MÉTHODE 1
sudo umount /dev/sdb1
> Convertir en ext4
sudo tune2fs -O extents,uninit_bg,dir_index /dev/sdb1 sudo fsck -pf /dev/sdb1 sudo e2fsck -f /dev/sdb1
> monter en ext4
sudo mount -t ext4 /dev/sdb1 /media/monRep
> Vérifier que le montage s’est bien effectué en ext4
sudo df -Th
NOTE : Il faut bien noter que cette nouvelle partition ne peut plus être montée en ext3. Ainsi, if the ext3 partition you are going to convert to ext4 is used by Grub during boot load process, make sure that Grub loader is capable boot using ext4 filesystem.
METHODE 2
Première étape… faire un backup !
sudo umount /media/monRep/
> Modify the ext3 filesystem to include ext4 features:
sudo tune2fs -O extents,uninit_bg,dir_index /dev/sdb1
>You won’t recieve much output from the command above, if it was successful. Once that command completes, optimize and repair filesystem directories and force a filesystem check with this command:
sudo e2fsck -fD /dev/sdb1 e2fsck 1.45.5 (07-Jan-2020) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 3A: Optimizing directories Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/sdb1: ***** FILE SYSTEM WAS MODIFIED ***** /dev/sdb1: 12/54216 files (0.0% non-contiguous), 12765/216060 blocks
>Now, we can test mount our new ext4 filesytem:
sudo mount /dev/sdb1 /media/monRep/ sudo mount | grep sdb1 /dev/sdb1 on /mnt/temp type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)
Et voilà…
MÉTHODE 3
> Vérifier le noyau
sudo uname -r 3.16.0-4-amd64
> Boot from Ubuntu Live CD
> Convert the filesystem to ext4
ext2 to ext4:
sudo bash tune2fs -O extents,uninit_bg,dir_index,has_journal /dev/sda1
ext3 to ext4:
sudo bash tune2fs -O extents,uninit_bg,dir_index /dev/sda1
Here, /dev/sda1 is the drive / partition name to be converted. To get a list of all partitions, use the command:
fdisk -l
4. Check the filesystem for errors
After running sudo commands, run fsck command to fix any repair issue that might have occurred during the above steps:
e2fsck -pf /dev/sda1
5. Mount the filesystem
Run sudo mount command to mount the partition:
sudo mount -t ext4 /dev/sda1 /mnt
You can check /mnt directory to ensure that the previous data is present there unaffected.
6. Update the filesystem type in fstab file
Open the /etc/fstab file of your original system. If you mounted it to /mnt, then the path is /mnt/etc/fstab.
nano /mnt/etc/fstab
Search for previous file system reference (ext2 or ext3) and edit it to ext4. Save the changes made to the file and exit.
7. Update grub
Now run the sudo bash command to refresh grub:
update grub
8. Reboot
Once all done, unmount /dev/sda and reboot the system.
cd /tmp umount /mnt shutdown -r now
If there is some damage to the Linux file system, you can fix it using fsck utility. It works well for ext2 or ext3 or ext4 File Systems. To Repair Linux ext2 or ext3 or ext4 file system, run the following commands as root user.
Steps to repair the file system using fsck
1. un-mount the file system:
umount /dev/sda1
2. Run fsck Fs-Name
Here, Fs-Name can be a device name, mount point, ext2 label, UUID specifier
fsck -t ext3 /dev/sda1 fsck.ext3 /dev/sda1
using
-tou.pour specifier le type de system4. fsck -y /dev/sda3. Or you can type it every time the system asks yes or no while fsck process.
> Remount the system after fsck process has been completed.
mount /dev/sda3
Note: Fsck failed to repair the Linux file systems?
No worries, you can try out the Linux recovery tools that allow you to recover the inaccessible data from any Ext4, Ext3, Ext2, exFAT, FAT32, FAT16, and FAT12 file system based LINUX volumes in an easy and safe way as compared to the manual mode.