# Ext4 vs SquashFS

**URL:** <https://forum.openwrt.org/t/ext4-vs-squashfs/25187>\
**Category:** Installing and Using OpenWrt\
**Created:** [November 14, 2018, 2:24pm UTC](https://forum.openwrt.org/t/ext4-vs-squashfs/25187 "2018-11-14T14:24:03Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![castillofrancodamian](https://forum.openwrt.org/letter_avatar/castillofrancodamian/32/5_5575768a8748004e209b776fc1b2916d.png) [@castillofrancodamian](https://forum.openwrt.org/u/castillofrancodamian)\
**Post date:** [November 14, 2018, 2:24pm UTC](https://forum.openwrt.org/t/ext4-vs-squashfs/25187/1 "2018-11-14T14:24:03Z")

</div>

I wanted to know what are the advantages and disadvantages of each one and in which device it is better to use one or the other.

---

<div class="post-metadata">

**Author:** ![lleachii](https://forum.openwrt.org/letter_avatar/lleachii/32/5_5575768a8748004e209b776fc1b2916d.png) [@lleachii](https://forum.openwrt.org/u/lleachii)\
**Post date:** [November 14, 2018, 2:57pm UTC](https://forum.openwrt.org/t/ext4-vs-squashfs/25187/2 "2018-11-14T14:57:49Z")

</div>

- [https://openwrt.org/docs/techref/filesystems](https://openwrt.org/docs/techref/filesystems)
- [http://www.linux-mag.com/id/7357/](http://www.linux-mag.com/id/7357/)
- [https://en.wikipedia.org/wiki/Ext4](https://en.wikipedia.org/wiki/Ext4)

The main difference is that you must used a compressed file system on most embedded devices, because they do not have enough space to hold the file system uncompressed.

---

<div class="post-metadata">

**Author:** ![castillofrancodamian](https://forum.openwrt.org/letter_avatar/castillofrancodamian/32/5_5575768a8748004e209b776fc1b2916d.png) [@castillofrancodamian](https://forum.openwrt.org/u/castillofrancodamian)\
**Post date:** [November 14, 2018, 6:42pm UTC](https://forum.openwrt.org/t/ext4-vs-squashfs/25187/3 "2018-11-14T18:42:46Z")

</div>

Okay. I'm going to use Ext4 on x86. Is there any way in this system to be able to rename the "factory state"?

---

<div class="post-metadata">

**Author:** ![lleachii](https://forum.openwrt.org/letter_avatar/lleachii/32/5_5575768a8748004e209b776fc1b2916d.png) [@lleachii](https://forum.openwrt.org/u/lleachii)\
**Post date:** [November 14, 2018, 7:13pm UTC](https://forum.openwrt.org/t/ext4-vs-squashfs/25187/4 "2018-11-14T19:13:04Z")

</div>

> [@castillofrancodamian](#):
>
> Is there any way in this system to be able to rename the "factory state"?

What do you mean by the phrase: "factory state"?

**(If this is question is not related to filesystems, you may wish to open another thread, and mark this one as solved.)**

---

<div class="post-metadata">

**Author:** ![Borromini](https://forum.openwrt.org/letter_avatar/borromini/32/5_5575768a8748004e209b776fc1b2916d.png) [@Borromini](https://forum.openwrt.org/u/Borromini)\
**Post date:** [November 14, 2018, 7:46pm UTC](https://forum.openwrt.org/t/ext4-vs-squashfs/25187/5 "2018-11-14T19:46:40Z")

</div>

> [@castillofrancodamian](#):
>
> 'm going to use Ext4 on x86. Is there any way in this system to be able to rename the "factory state"?

That's where SquashFS comes in more handy. While you can opt for ext4 on x86 targets that have enough storage, SquashFS being read-only means you can effectively reset your device (factory state just wipes the overlay partition which stores settings and packages you added after flashing). With the ext4 images, to my knowledge, you get none of that, since your root filesystem is just a writable ext4 partition.

Of course, using `sysupgrade -F` with a fresh image would do the same as a factory reset (minus the wear on your storage 😃 ).

---

<div class="post-metadata">

**Author:** ![castillofrancodamian](https://forum.openwrt.org/letter_avatar/castillofrancodamian/32/5_5575768a8748004e209b776fc1b2916d.png) [@castillofrancodamian](https://forum.openwrt.org/u/castillofrancodamian)\
**Post date:** [November 14, 2018, 9:24pm UTC](https://forum.openwrt.org/t/ext4-vs-squashfs/25187/6 "2018-11-14T21:24:57Z")

</div>

To be able to restart the system as it comes from the factory. At least, as it started for the first time.

---

<div class="post-metadata">

**Author:** ![castillofrancodamian](https://forum.openwrt.org/letter_avatar/castillofrancodamian/32/5_5575768a8748004e209b776fc1b2916d.png) [@castillofrancodamian](https://forum.openwrt.org/u/castillofrancodamian)\
**Post date:** [November 14, 2018, 9:25pm UTC](https://forum.openwrt.org/t/ext4-vs-squashfs/25187/7 "2018-11-14T21:25:41Z")

</div>

And is not there something similar for Ext4?

---

<div class="post-metadata">

**Author:** ![lleachii](https://forum.openwrt.org/letter_avatar/lleachii/32/5_5575768a8748004e209b776fc1b2916d.png) [@lleachii](https://forum.openwrt.org/u/lleachii)\
**Post date:** [November 14, 2018, 9:31pm UTC](https://forum.openwrt.org/t/ext4-vs-squashfs/25187/8 "2018-11-14T21:31:35Z")

</div>

> [@castillofrancodamian](#):
>
> To be able to restart the system as it comes from the factory. At least, as it started for the first time.

I understand. As @Borromini noted, resetting the device to default is much easier on SquashFS.

> [@castillofrancodamian](#):
>
> And is not there something similar for Ext4?

As he noted, I likewise beleive that such wouldn't be possible on an ext4 based device, without using **sysupgrade -f.**

---

<div class="post-metadata">

**Author:** ![castillofrancodamian](https://forum.openwrt.org/letter_avatar/castillofrancodamian/32/5_5575768a8748004e209b776fc1b2916d.png) [@castillofrancodamian](https://forum.openwrt.org/u/castillofrancodamian)\
**Post date:** [November 14, 2018, 9:34pm UTC](https://forum.openwrt.org/t/ext4-vs-squashfs/25187/9 "2018-11-14T21:34:59Z")

</div>

And how could I use that command for that purpose?

---

<div class="post-metadata">

**Author:** ![jeff](https://forum.openwrt.org/letter_avatar/jeff/32/5_5575768a8748004e209b776fc1b2916d.png) [@jeff](https://forum.openwrt.org/u/jeff)\
**Post date:** [November 14, 2018, 9:42pm UTC](https://forum.openwrt.org/t/ext4-vs-squashfs/25187/10 "2018-11-14T21:42:03Z")

</div>

`sysupgrade -f /path/to/firmware.image` is the "sledgehammer" of "replace this filesystem with that in the firmware supplied on the line".

With ext4, I personally would use a backup regimen with `tar` and/or `rsync` and be able to "go back" as I needed for specific files, rather than the whole thing.

---

<div class="post-metadata">

**Author:** ![lleachii](https://forum.openwrt.org/letter_avatar/lleachii/32/5_5575768a8748004e209b776fc1b2916d.png) [@lleachii](https://forum.openwrt.org/u/lleachii)\
**Post date:** [November 14, 2018, 9:43pm UTC](https://forum.openwrt.org/t/ext4-vs-squashfs/25187/11 "2018-11-14T21:43:59Z")

</div>

> [@castillofrancodamian](#):
>
> And how could I use that command for that purpose?

- Login to the router via SSH
- `cd /tmp`
- `wget http://downloads.openwrt.org/releases/18.06.1/targets/foo/foo-ext4.bin`
- `sysupgrade -f foo-ext4.bin`

**("Foo" is a placeholder, you would download the appropriate firmware for you device.)**

---

<div class="post-metadata">

**Author:** ![castillofrancodamian](https://forum.openwrt.org/letter_avatar/castillofrancodamian/32/5_5575768a8748004e209b776fc1b2916d.png) [@castillofrancodamian](https://forum.openwrt.org/u/castillofrancodamian)\
**Post date:** [November 14, 2018, 11:07pm UTC](https://forum.openwrt.org/t/ext4-vs-squashfs/25187/12 "2018-11-14T23:07:21Z")

</div>

Ok, and finally, is there any speed advantage of using Ext4 instead of SquashFS or vice versa?

---

<div class="post-metadata">

**Author:** ![lleachii](https://forum.openwrt.org/letter_avatar/lleachii/32/5_5575768a8748004e209b776fc1b2916d.png) [@lleachii](https://forum.openwrt.org/u/lleachii)\
**Post date:** [November 14, 2018, 11:19pm UTC](https://forum.openwrt.org/t/ext4-vs-squashfs/25187/13 "2018-11-14T23:19:13Z")

</div>

> [@castillofrancodamian](#):
>
> and finally, is there any speed advantage of using Ext4 instead of SquashFS or vice versa?

You know, you could ask all your questions at once.

- [https://elinux.org/Squash\_Fs\_Comparisons](https://elinux.org/Squash_Fs_Comparisons)
- [https://groups.google.com/forum/#!topic/fa.linux.kernel/1EEhADKYr9Q](https://groups.google.com/forum/#!topic/fa.linux.kernel/1EEhADKYr9Q)

---

<div class="post-metadata">

**Author:** ![dlakelan](https://forum.openwrt.org/user_avatar/forum.openwrt.org/dlakelan/32/2320_2.png) [@dlakelan](https://forum.openwrt.org/u/dlakelan)\
**Post date:** [November 15, 2018, 5:00am UTC](https://forum.openwrt.org/t/ext4-vs-squashfs/25187/14 "2018-11-15T05:00:20Z")

</div>

btrfs has filesystem snapshots, though I don't know if it's supported by openwrt as a root fs. Perhaps you could mount a btrfs after initial boot.

---

<div class="post-metadata">

**Author:** ![castillofrancodamian](https://forum.openwrt.org/letter_avatar/castillofrancodamian/32/5_5575768a8748004e209b776fc1b2916d.png) [@castillofrancodamian](https://forum.openwrt.org/u/castillofrancodamian)\
**Post date:** [November 15, 2018, 2:59pm UTC](https://forum.openwrt.org/t/ext4-vs-squashfs/25187/15 "2018-11-15T14:59:06Z")

</div>

I do not understand. I am new at this.

---

<div class="post-metadata">

**Author:** ![lleachii](https://forum.openwrt.org/letter_avatar/lleachii/32/5_5575768a8748004e209b776fc1b2916d.png) [@lleachii](https://forum.openwrt.org/u/lleachii)\
**Post date:** [November 15, 2018, 3:58pm UTC](https://forum.openwrt.org/t/ext4-vs-squashfs/25187/16 "2018-11-15T15:58:45Z")

</div>

> [@castillofrancodamian](#):
>
> I do not understand. I am new at this.

I hope that your questions were answered.  
If not, what are you having trouble understanding?

---

<div class="post-metadata">

**Author:** ![castillofrancodamian](https://forum.openwrt.org/letter_avatar/castillofrancodamian/32/5_5575768a8748004e209b776fc1b2916d.png) [@castillofrancodamian](https://forum.openwrt.org/u/castillofrancodamian)\
**Post date:** [November 15, 2018, 4:36pm UTC](https://forum.openwrt.org/t/ext4-vs-squashfs/25187/17 "2018-11-15T16:36:52Z")

</div>

I already understand more or less what I asked. What I do not understand is what he said  
dlakelan.

---

<div class="post-metadata">

**Author:** ![dlakelan](https://forum.openwrt.org/user_avatar/forum.openwrt.org/dlakelan/32/2320_2.png) [@dlakelan](https://forum.openwrt.org/u/dlakelan)\
**Post date:** [November 15, 2018, 4:48pm UTC](https://forum.openwrt.org/t/ext4-vs-squashfs/25187/18 "2018-11-15T16:48:42Z")

</div>

I'm saying that if you are looking for a filesystem that can be set up with a read-only snapshot that can be reverted, then btrfs is capable of this kind of thing. I assume this is only for x86 based devices with lots of storage space, because I have no idea how that would work on a typical embedded router device.

If you don't understand what I'm talking about already, then this route is probably not for you. btrfs takes some knowledge to administer it has many many useful options, perhaps later in your learning you will find this useful.

---

<div class="post-metadata">

**Author:** ![castillofrancodamian](https://forum.openwrt.org/letter_avatar/castillofrancodamian/32/5_5575768a8748004e209b776fc1b2916d.png) [@castillofrancodamian](https://forum.openwrt.org/u/castillofrancodamian)\
**Post date:** [November 15, 2018, 6:03pm UTC](https://forum.openwrt.org/t/ext4-vs-squashfs/25187/19 "2018-11-15T18:03:23Z")

</div>

That's why I have to read and learn before doing something. I always start with the practical part 😅😅

---

<div class="post-metadata">

**Author:** ![system](https://forum.openwrt.org/uploads/default/original/3X/7/4/740520c71f00039bbf001045c682f0ecb25e905a.png) [@system](https://forum.openwrt.org/u/system)\
**Post date:** [November 25, 2018, 6:03pm UTC](https://forum.openwrt.org/t/ext4-vs-squashfs/25187/20 "2018-11-25T18:03:26Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
