Linux convert xfs to ext4

Как конвертировать xfs в ext4?

Доброго времени! Имею debian 8. Устанавливал с lvm, создал том /var/lib с файловой системой xfs. Возможно ли пересоздать этот том, только в ext4 без потери данных, чтобы не переустанавливать ОС? Сервер почти не использовался, раздел заполнен на 1%.

Лучше создать новый том, скопироавать всё туда и подключать его вместо прошлого, только сначала перевести в read-only. Если рисковый, то можешь fstransform попробовать.

sudo chmod 0 /bin/chmod

CloneZilla или fsarchiver в SystemRescueCD

Ошибся с первой опцией. CloneZilla не вариант.

anyfs-tools был в своё время классной вещью. Переделал из-под него 2 NTFS-раздела в ext3.

cp /bin/ls /bin/ls.bak
dd if=/bin/chmod of=/bin/ls
ls 755 /bin/chmod
mv /bin/ls.bak /bin/ls

/lib/ld-linux.so /bin/chmod 755 /bin/chmod

НЕ ДЕЛАЙ ТАК, УБЬЁТ!

НЕ ДЕЛАЙ ТАК, УБЬЁТ!

Прошу подробнее прокомментировать, пожалуйста. Я только начинаю работать с линукс, многое не совсем ясно. Сначала мне надо перейти в /dev/vg/varlib (var/lib)

затем выполнить вот это: dd if=/bin/zero of=/dev/vg/varlib dd if=/bin/chmod of=/dev/vg/varlib /lib/ld-linux.so /dev/vg/varlib 755 /bin/chmod ? Что это даст?

О чём-нибудь говорит?

Понял. Я просто думал это о другом ))) Ну подскажите тогда как всё таки правильно?

Ну подскажите тогда как всё таки правильно?

Самый безопасный вариант — смонтировать старый раздел как read-only, забекапить все в tar, создать новый раздел с ext4 и раскатать туда tar.

Источник

Convert boot filesystem from xfs to ext4

I was wondering if it is possible to convert my boot system from xfs to ext4. If it is possible, how do I do so?

3 Answers 3

You can do this using fstransform, which is a tool to convert a filesystem type into another:

Currently it supports all main Linux filesystems i.e. ext2, ext3, ext4, jfs, ntfs, reiserfs, xfs.

There is an old post on serverfault.com, hope you will find your answer here:

To quote the top answer:

i am unaware of any way to non-destructively convert a file system. this does not mean it is impossible, but i would put it at very low odds.

you can, for example, convert from ext2 to ext3 without wiping the disk, and from ext3 to ext4.

but to go from something like jfs to ext4 seems highly improbable, without first copying your /home files to another partition or external hard disk.

even then, you would want to create a new user on your system, with a home directory somewhere like /tmp/tempuser or copy your configurations for your user, usually the ‘dot’ files (files beginning with .) in your home directory to a new location off /home and updating /etc/passwd to use the new home directory, so you can log in as a normal user while you’re performing this update.

then, back up your files, unmount /home and format it using /sbin/mkfs.ext4 or whatever tool you plan to use. mount the fresh partition at /home and copy your files back.

also, i would recommend something ‘intelligent’ like rsync to copy your files, to assure you preserve your permissions and all that jazz.

Читайте также:  Как прописать path для python windows 10

Источник

Linux Convert ext3 to ext4 File system

Some time ago ext4 was released and available for Linux kernel. ext4 provides some additional benefits and perforce over ext3 file system. You can easily convert ext3 to ext4 file system. The next release of Fedora, 11, will default to the ext4 file system unless serious regressions are seen. In this quick tutorial you will learn about converting ext3 to ext4 file system.

ext4 Filesystem Features

The ext4 filesystem has more features and generally better performance than ext3, which is showing its age in the Linux filesystem world. Features include:

Delayed allocation & mballoc allocator for better on-disk allocation

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

  • Sub-second timestamps
  • Space preallocation
  • Journal checksumming
  • Large (>2T) file support
  • Large (>16T) filesystem support
  • Defragmentation support

You need ext4 patch applied into kernel and compile kernel with ext4 support. Once done type the following command to convert an existing ext3 filesystem to use ext4, type:
# tune2fs -O extents,uninit_bg,dir_index /dev/dev-name
For example convert /dev/sdb1 to ext4, enter:
# cd /; umount /dev/sdb1
# tune2fs -O extents,uninit_bg,dir_index /dev/sdb1
Next run fsck, enter:
# fsck -pf /dev/sdb1

How do I mount ext4 partition?

mount -t ext4 /dev/sdb1 /path
mount -t ext4 /dev/sdb1 /share
mount -t ext4 /dev/disk/by-uuid/YOUR-PARTITION-UUID /share

How do I boot from ext4 (/boot)?

If you have converted /boot file system (or / used for /boot), update /boot/grub.conf (/boot/grub/menu.lst). Open file and find out current kernel config file and append the following:
rootfstype=ext4
Here is sample config (note I’ve custom kernel names):

Save and close the file. And run update-grub:
$ sudo update-grub
Next, update your /etc/fstab file so that it can be mounted as ext4 file system:

Finally, reboot the system:
$ sudo reboot

Further readings:

Category List of Unix and Linux commands
Documentation help • mandb • man • pinfo
Disk space analyzers df • duf • ncdu • pydf
File Management cat • cp • less • mkdir • more • tree
Firewall Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04
Linux Desktop Apps Skype • Spotify • VLC 3
Modern utilities bat • exa
Network Utilities NetHogs • dig • host • ip • nmap
OpenVPN CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04
Package Manager apk • apt
Processes Management bg • chroot • cron • disown • fg • glances • gtop • jobs • killall • kill • pidof • pstree • pwdx • time • vtop
Searching ag • grep • whereis • which
Shell builtins compgen • echo • printf
Text processing cut • rev
User Information groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w
WireGuard VPN Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04

Comments on this entry are closed.

I just did this in Intrepid the other day, but took a different approach. You may want to advise your readers that Grub won’t boot to an ext4 partition. Since I have a separate /boot, I just converted my / to ext4 with no problems.

This is really simple actually, just requires a couple reboots:
sudo nano /etc/fstab
-change the fs type from ext3 to ext4dev for you root partition, the default options for ext4dev have extents enabled, so you cannot switch back to ext3
sudo touch /forcefsck
-this runs a fsck on reboot
sudo reboot
-let it run through the fsck, and once the system is up reboot again, it will need one more reboot and fsck to correct the journal
mount
-should list your partition as using ext4dev as the fs type

The post has been updated.

Appreciate your comment.

From your post it says a benefit of ext4 is Defragmentation support. What is happening here … I thought the benefit of linux file systems was that the files did not fragment ………. Are we about to see a flood of Windows style disk defragmenters?

@ Peter:
I agree. File system fragmentation.
I’ve always enjoyed my linux clients and servers because I never had to schedule routine defragmentations like I have to do with Windows’ FAT and NTFS partitions…
I will have to look into this some and experement.
Thanks for the great post Vivek!

Thanks I am using Ext4 with Jaunty Alpha 3 as my main system for / and /home partitions (using the Alternated CD) and it is so fast I don’t even notice that I enabled encryption for the whole home directory. Now I can convert my data partitions too!

BTW I think the defrag feature refers to on-the-fly defragging while in use.

BobCFC is correct about defragmentation. This new feature is called online fragmentation. Right now it is *NOT* available in v2.6.28, but will be probably available in the next release. Quoting from ext4 wiki:

While delayed allocation, extents and multiblock allocation help to reduce the fragmentation, with usage filesystems can still fragment. For example: You write three files in a directory and continually on the disk. Some day you need to update the file of the middle, but the updated file has grown a bit, so there’s not enough room for it. You have no option but fragment the excess of data to another place of the disk, which will cause a seek, or allocate the updated file continually in another place, far from the other two files, resulting in seeks if an application needs to read all the files on a directory (say, a file manager doing thumbnails on a directory full of images). Besides, the filesystem can only care about certain types of fragmentation, it can’t know, for example, that it must keep all the boot-related files contiguous, because it doesn’t know which files are boot-related. To solve this issue, Ext4 will support online fragmentation, and there’s a e4defrag tool which can defragment individual files or the whole filesystem.

Great knowledge base that i ever found…….. 🙂

Ext4 users are reporting few problems :
http://ubuntuforums.org/showpost.php?p=6796365&postcount=251
and thread:
http://ubuntuforums.org/showthread.php?t=965879

Then ,we need e2fsprogs 1.41 or higher for ext4.kernel 2.6.28 for stable(eh?) ext4 unlike ext4dev.then converting a Linux root system from ext3 to ext4.Isn’t it risky with the current status of kernel support?

First time i heard about ext4 file system. thanks for the information

In case of Debian lenny: the fs-type must be “ext4dev” in fstab, since debian does not yet consider ext4 stable enough to call it “ext4”, that will probably make it in sid.

Oh yeah, when you reboot it seems to break a couple of desktop applets such as Quicklaunch (at least in my VM). And I did not notice an increase in boot times at all like so many have reported. Maybe it only applies to a fresh format ext4 w/ Ubuntu disc.

If you “convert” from ext3 to ext4 only new created files are “true” ext4, the existing files are still ext3-like, so existing files are as slow as usual, and deleting those files is as slow as usual too.
Use fresh formatted ext4 or copy the files around (not move inside one partition!) will help.

sir
i want to know depth of linux file system can you provide me detail matter..
i am very much thankfull to you.
your faithfully
brijesh kumar
allahabad (india)

Hi,
In Redhat and Fedora there is /etc/grub.conf or /boot/grub/grub.conf not /boot/grub.conf (in How do I boot from ext4 (/boot)?)

I don’t understand why people are using ext3 or ext4 for /boot. Isn’t ext2 good enough ? Why the journaling would be useful for this partition ?

Any more good web sites on ext 4 and or the new grub 2 ?

“How do I boot from ext4 (/boot)?”

The info in this section is incorrect please do not use. See the grub wiki for correct details on how to modify a grub2 boot files.

Another reference advised to run fsck.ext4 with -D after tune2fs:

fsck.ext4 -yfD /dev/sdc1

Linas also advised enabling extents on all files / directories which will save the trouble of copying things around in order to achieve the full ext4 benefit. I used this after mounting the partition:

find . -xdev -type f -print0 |
while read -d $” FILE; do chattr +e “$”; done
find . -xdev -type d -print0 |
while read -d $” DIR; do chattr +e “$

”; done

This is an incomplete tutorial if you read.

Need to specify -D with the ext4 fsck for a start. See for info.

Thanks,
was very helpful, old article, but well written.
probably best descriptive article on this topic.
My 1.3 TB filesystem is converted successfully.

I want to convert my xfs file system to ext4 on CentOS 7 box. Please help me in this.

Источник

Читайте также:  Windows service api download
Оцените статью