r/linuxquestions • • Mar 03 '21

Why does Linux take much less storage space that Windows?

Is it because of better updates, package management, or something else?

181 Upvotes

111 comments sorted by

186

u/Sky_Sumisu Mar 03 '21

As others have answered: Linux's packages share dependencies with each other, Window's tend not to. There's a reason that many Linux users think very negatively of things that do not work like that on Linux (PPA's, Snaps, Flatpaks, AppImages, etc).
Another reason is the so called "bloat": Poorly coded/compressed programs, unnecessary software, programs that do more things than they should do, and programs that are monolithic instead of modular/extensible.

42

u/[deleted] Mar 03 '21

As others have answered: Linux's packages share dependencies with each other, Window's tend not to.

The times are changing now though, with Go and Rust usually static linking outside of glibc.

And Flatpak + Snap as you mentioned.

21

u/vapenicksuckdick Mar 03 '21

You have an option not to use programs written that way

23

u/[deleted] Mar 03 '21

I write Rust.

It's not all downsides, static linking makes it easier to deploy and allows the compiler to make better optimisations.

9

u/wjwwjw Mar 04 '21

optimisationS

Why would static linking allow the compiler to make better optimisations? Only thing i see is that you don’t copy the library into your final library but that’s about it

22

u/[deleted] Mar 04 '21 edited Mar 04 '21

For Rust usually the crates are built from source, so the compiler can see all of the source code and what you use.

Rather than C style separate compilation units with header files.

EDIT: This is vital for Rust's generics with monomorphisation.

10

u/oxamide96 Mar 04 '21

Can someone do a noob explain (ELI5 I guess?) of glibc "linking" and advantages of static linking outside of it as done by Rust and Go?

19

u/michaelkrieger Mar 04 '21

you have a library file [DLLs in windows, shared library’s in Linux]. The library file includes a series of functions and other structures that are commonly used in your application or across applications. Your application can do one of two things. It can either reference that it needs this external dependency, or it can copy the external dependency into the application executable.

Space: If you have one program and one library, it likely makes no difference in space. Now have 5 programs statically linked and you’ve duplicated the same compiled code 5 times.

Upgrades: let’s say there is a security issue in a library shared across many programs. Say OpenSSL. If statically linked, you have to recompile every program. If dynamically linked you replace the library (so long as the API doesn’t change)

Portability: static linking means I can ship a single file program and it will work and not depend on the user having the appropriate library. This lowers support cost and improves usability.

The most common library is the C library or VC++ libraries. These core functions such as outputting text or opening a file are used across every program made in those languages.

On Linux, type ‘ldd filename’ and see the libraries it needs to run.

4

u/heavyheaded3 Mar 04 '21

OK so I don't know anything but...

I think it might have something to do with how when I need to install some program in Linux I sometimes have to wrestle with various dependencies I need to find for unsupported distros or I'm building from source...all things typically automated by package managers.

Though when I compile "hello, world!" in C its 8 kilobytes. In Rust? 3.2 MEGAbytes.

2

u/[deleted] Mar 04 '21

Though when I compile "hello, world!" in C its 8 kilobytes. In Rust? 3.2 MEGAbytes.

That's like saying the Python version is only 16 bytes, because it's just the script, ignoring that you have to install Python.

If you were to statically link then it'd be larger (but more portable - like the Rust version). Also in Rust make sure you aren't building in debug mode (and you could then strip the binary and disable panics for even more space saving).

1

u/Tm1337 Mar 04 '21

That's not because of static linking. After all, a hello world program does not need many libraries.

It has more to do with the things rust includes as features or help for the developer. For example a 3MB hello world is compiled in debug mode and includes debug information, which is stripped from release builds. Apart from that, every reference I can find suggests a high, but not '3MB' high hello world size.

https://prev.rust-lang.org/en-US/faq.html#why-do-rust-programs-have-larger-binary-sizes-than-C-programs

1

u/heavyheaded3 Mar 04 '21 edited Mar 04 '21

Thanks! FWIW the release version is also 3 gb mb.

1

u/Tm1337 Mar 04 '21

lol, that would be absolutely massive indeed.

1

u/claytonkb Mar 04 '21

Can someone do a noob explain (ELI5 I guess?) of glibc "linking" and advantages of static linking outside of it as done by Rust and Go?

Static linking: Is performed at compile-time and forever "binds" the linked library functions into the the compiled executable object. This is like welding components into your RV before you hit the road... once welded in, they never come out and you must pay to transport them over every mile.

Dynamic linking: Is performed at run-time on an as-needed basis. There is some performance penalty at startup (one-time only) because the dynamic linker has to perform some of the steps at run-time that the compiler would have performed at compile-time in the case of static linking. This is like bolting components into your RV after you are already on the road. If you get started on your trip and realize that you don't need something, you are not obligated to install it and you can save the time/energy required to transport that extra weight around everywhere.

The other advantage of dynamic linking is system-wide. If every program was statically linked, then they would all have their own copy of each library. This is like an RV park where everybody has their own water supply, electric generators, black tanks, and so on, rather than hooking up to the hookups. When you dynamically link, the OS only has to maintain one copy of each library, and all installed programs can dynamically link up to that. This saves space and it can actually be more performant than static linking at startup because the sheer number of object file bytes that have to be loaded into memory is much smaller (as libraries already tend to be loaded in memory).

Note that C programs can utilize either static or dynamic linking. Also note that package-management is a separate (though obviously related) problem from linking. If you statically link, you usually don't need to worry about package dependencies (your program will just run because it has everything it needs welded onboard) but if you dynamic link, then the packages that your program depends on (to link) must be installed in the system prior to running.

1

u/oxamide96 Mar 04 '21

Thank you so much for the in depth explanation! So it seems to me that dynamic linking has more advantages. Why did Rust and Go take the route of static linking?

1

u/claytonkb Mar 05 '21

Unfortunately, I dont know enough about those languages to answer.

21

u/Eleventhousand Mar 03 '21

As others have answered: Linux's packages share dependencies with each other, Window's tend not to.

The funny thing is that Windows used to get bashed hard for DLL hell. I think they went really far in the opposite direction. Though without repos, I suppose it would be difficult to manage versions and dependencies nicely.

9

u/brimston3- Mar 03 '21

DLL hell is what linux has now. That's exactly the problem snap, flatpak, and appimage systems are designed to solve. Windows managed it by using COM and strict ABI versioning, which is why they have layers and layers of backwards compatibility and so many different VC++ Runtimes.

8

u/Valmar33 Mar 04 '21

What?

Snap, Flatpak and AppImage are all recreations of DLL hell ~ statically-linked libraries ahoy.

Traditional package management involving dynamic linking eliminates this entirely.

-1

u/brimston3- Mar 04 '21

The world is not all FOSS. Operating with that expectation is naive.

And even if it was all FOSS, eventually someone is going to have to deal with importing/exporting data from a niche legacy data format of a program that is no longer developed and no longer compiles. If it's a flatpak, and the flatpak compatibility runtime is still available (it should be), then the software can be made to run with minimal porting effort.

7

u/ramin-honary-xc Mar 04 '21

DLL hell is what linux has now.

Is it really a "hell" though? Unlike Windows, which basically left their developers to their own devices for dependency management, Linux solves this problem with package managers like Debian's APT, or RedHat's DNF. Windows even has Chocolatey now, and Mac OS has Homebrew.

And now there are new technologies like Nix and Guix which take package management to the next level with their own functional declarative package management languages that use content addressable stores to hold packages.

-3

u/edparadox Mar 04 '21

The funny thing is that Windows used to get bashed hard for DLL hell. I think they went really far in the opposite direction.

This is a wrong statement.

Why do you think you install that many "redistributables" when install most Win32/Win64 programs?

22

u/bss03 Mar 03 '21 edited Mar 03 '21

Some of it is backwards compatibility. There used to be a video on the web of someone running a Win 1.0 application (yeah, with a GUI) on each and every version up to XP.

That doesn't seem to be the end-user experience on Linux. Every time I've seen bw-compat broken on Linux it was due to a library removing some API, not the kernel, but it's still true than I don't think you can take any Linux GUI programs from '98 and run them on the latest Debian without recompiling (and maybe not even with recompiling).

3

u/ToneWashed Mar 04 '21

That's almost certainly true about needing to recompile. But in 1998 many Linux GUI apps were themselves the portable UNIX GUI apps of the day, written for Motif but runnable with Lesstif or such. You could probably dig up some 23 year old GUI code and get it building on a modern system without tremendous effort.

The problem is with integrated desktop environments. There were no FOSS ones until around 1998 when KDE and GNOME got started and the "integrated" part is never future-proof with FOSS desktops. Like you said there's ancient Windows 1.x binaries which could still work but even with the full code for a KDE 1.x app, it's not going to integrate with any part of any modern desktop environment including modern KDE, and it's forever married to an encumbered widget library (Qt 1/2).

74

u/[deleted] Mar 03 '21 edited Mar 03 '21

This is not entirely correct, it totally depends of what Linux distributions you pick and what packages you download during install. Windows takes so much space because it comes with a full suite of mostly useless software for various tasks, most Linux distributions allow to install more or less software which means it requires less storage to work. Manufacturers usually also add extra bloatware on their prebuilds that do nothing but waste even more bytes of storage, that's why i recommend erasing and reinstalling Windows from scratch on prebuilds.

24

u/ThrowAway237s Mar 03 '21

"Bloatware" is a subjective term. For example, Ubuntu Studio comes with a lot of multimedia software. Some would (power users) consider it as "bloat", while others consider them as tools ready to be used whenever needed.

On smartphones, the term was misused for concern trolling, distracting from much larger issues such as non-replaceable batteries and lack of memory card slot.

32

u/abrasiveteapot Mar 03 '21

On smartphones, the term was misused for concern trolling

Respectfully disagree, installing the Facebook app and similar unwanted apps onto an android phone to the point there was limited space left for apps you actually wanted, and then setting up the phone so it's impossible for an average user to uninstall them is what lead to the bloatware rage. Yes I eventually tracked down adb and sorted all my friends out with it too, but 7-10 years ago I was very frustrated with Samsung HTC et al

12

u/ThrowAway237s Mar 03 '21

Yes, those precluded social media apps are really unnecessary, as those could be downloaded anyway if needed. But forum users also described the Air View and Air Gesture features as such.

But still, those bother me far less than the inability to replace the shortest-lived component without risking to break the device.

1

u/ccAbstraction Mar 04 '21

Are there any phones that aren't this bad? I'm still on a Moto G4, yeah, the battery has puffed up just enough that I can't remove the screws (plus loctite on T3 screws....) but at least it's not completely glued shut. Is there anything out there that's sub $250, actually has better specs than a G4, and doesn't treat me like a lapdog? I've been considering the PinePhone, but I need something that actually works...

1

u/klementineQt Dec 12 '23

OnePlus Nord N200? it's pretty affordable, is actually super nice for the price, isn't bloaty by any means. Pretty awesome phone. OnePlus has apparently shit the bed a bit on their flagships but their cheaper stuff is still a rock solid deal imo

1

u/ccAbstraction Dec 12 '23

This comment was 2 years old. I bought a used Pixel 3a not long after. Let's hope this one doesn't have a similar fate. I should look into buying a heat gun in advance...

1

u/klementineQt Dec 13 '23

i found this post through a search and didn't even think about the timestamp, my bad lol

i actually have an almost 3 year old pixel 4a that i've busted the screen on, but i'm still using it bc i don't want to downgrade and a new phone isn't in the cards anytime soon. it still works fine other than the several white lines on the screen

8

u/jclocks Mar 03 '21

Back in the day it didn't matter what card you stuck in there though; if you had an 8GB phone and it came preloaded with 7GB of apps you were fucked no matter what aside from rooting

1

u/ThrowAway237s Mar 07 '21

Correction: Mininalists consider it bloat, while power users could utilize it.

Power users often are a supressed minority in the technology world, thus have to suffer.

0

u/[deleted] Mar 03 '21

[deleted]

3

u/happymellon Mar 04 '21

Why would you throw out stuff you already paid for?

Unless you are upgrading your keyboard and mouse, Microsoft already has your money.

27

u/couchwarmer Mar 03 '21

By default the Windows page/swap and hibernation files are located in the OS partition. People often forget to account for these or their Linux counterparts when comparing the two systems.

1

u/ccAbstraction Mar 04 '21

Doesn't Ubuntu ship with a swapfile now?

1

u/Scraft161 Mar 04 '21

Not sure about ubuntu specifically but most other systems have a swap partition instead of a swap file, the difference is that a swap partition can be shared across multiple installs (linux x linux) on the same hard drive.

I personally have the same amount I have for ram but I never end up using more than 6-7 gigs even with a game and web browser open

1

u/JustMrNic3 Mar 05 '21

True!

By default my Linux distro uses very little swap and hibernation doesn't work at all.

32

u/lutusp Mar 03 '21 edited Mar 03 '21

Is it because of better updates, package management, or something else?

All those, but there are more universal reasons, like accumulating cruft over time. Windows has gotten much larger over time, and Linux has too (both the kernel and a typical install). I suspect at a basic physical level it has to do with entropy (increasing disorder as a function of time).

Correspondent u/NoT_A_GooD_LaD points out that Windows apps tend to be packaged with their own dependencies (making them larger), and Linux apps don't. But this is less true over time. A recent trend is toward packaged, "sandboxed" Linux apps using AppImage, Flatpak and other packaging schemes to avoid library conflicts. These are much larger, but are immune to package conflicts and allow Linux users to have the most recent app releases.

18

u/[deleted] Mar 03 '21

And even flatpak reuses the same depencies for all flatpaks

1

u/lutusp Mar 03 '21

Didn't know that, interesting. So Flatpak looks around for compatible libraries among other Flatpak installs to try to find a suitable library, while rejecting any that might cause problems. Maybe the default package managers should do it that way. :)

6

u/brimston3- Mar 03 '21

The program in question has to declare its runtime dependencies, and flatpak will pull that versioned runtime library set (roughly based on a release of Fedora) and cascaded dependencies. The runtimes are basically target platforms. Then at runtime, flatpak will bubblewrap the whole thing into a filesystem namespace for you, linking in the correct runtime files and a number of IPC endpoints for things like pulseaudio and dbus. When the runtime libraries get updated (eg, security updates), all dependent programs are updated at once.

I personally think that (mandatory) explicit versioning should be at a lower, more granular level than copies of the filesystem, but if this is what it takes to get it into the linux software ecosystem, so be it.

1

u/happymellon Mar 04 '21

Sort of, but also not really. Flatpak is based upon OCI technologies, think containers and Docker.

With this world you have "layers", with each layer containing files, so if I create a program that uses Python 3.8, any other program that uses Python 3.8 should reuse the same Python 3.8 layer with their application overlaid on top of the generic Python 3.8 image. Now other programs might have a bug with Python 3.8 so they use Python 3.6 which is a different image.

However both Python 3.8 and Python 3.6 can use common external libraries and they could be at a lower layer so that the only additional space taken up by this is the space required by both installs of Python itself. This does not stop people being silly and including a full copy of Python with supporting libraries in their Flatpak application, but it does provide tooling to not do this. Flatpak is not magic and will not just find libraries if the application does not declare it.

https://docs.flatpak.org/en/latest/basic-concepts.html

11

u/supermario9590 Mar 03 '21

Windows comes with a demo of MS office, has two different shells, two settings applications, and lots more

8

u/MitchellMarquez42 Mar 04 '21

Also two (arguably 3) web browsers, 2 drawing/paint programs, and several smartphone games,

4

u/StereoRocker Mar 03 '21

I take it you're referring to command line shells, not the graphical shell (explorer.exe)?

2

u/supermario9590 Mar 04 '21

Yes, I am referring to what a Linux shell would be

10

u/[deleted] Mar 03 '21

LTSC installs of Windows, which are notoriously difficult to get but chop out all the bloat that comes with standard w10, install to about 10GB. A standard w10 install of the same version installs to 18GB. Also, Windows has tried to keep compatability for every possible use case that's cropped up over the past >20 years, so I'm sure that hasn't helped in the slightest either.

10

u/Whatevernameisnt Mar 03 '21

When I was a kid I didn't know what dll was. Just needed space on the family computer "that looks suspicious to me!" Deletedeletedeleted

Gotta lotta space but nothing worked right.

5

u/nMaib0 Mar 04 '21

Why do we need libraries anyways

9

u/michaelpaoli Mar 03 '21

One of the reasons, is that Microsoft Windows is so bloated, is that to a large extent it tries to be "everything to everybody" - and thus tends to have a whole lot o' stuff in it ... whether one needs or wants it, or not. Sure, one can create a huge Linux installation too ... but why install a bunch of stuff one doesn't want or need. Linux can be very lean.

# cat /etc/debian_version && uname -m && dpkg -l | grep '^ii ' | wc -l && df -h -x devtmpfs -x tmpfs && free && head -n 1 /proc/meminfo
10.8
x86_64
161
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1       1.4G  744M  575M  57% /
              total        used        free      shared  buff/cache   available
Mem:         131296       40720       14440        1460       76136       83740
Swap:             0           0           0
MemTotal:         131296 kB
# 

Much smaller is very doable, but that's just one example of a very common distro, reasonably stripped down, and without even going to a whole lot of effort to potentially make it even much smaller. Pretty much infeasible with Microsoft Windows ... not to mention you don't get source code, so you can't more easily continue to trim things out of it even if you wanted to and had the expertise to do so.

6

u/HCrikki Mar 03 '21 edited Mar 03 '21

First, a large number of shared dependencies.

Applications and games dont need to release their own copy of a dll or other libraries because they reuse whatever's already installed or obtainable from repositories (in their latest version).

Second, a willingness to get rid sooner of stale and outdated libraries, unlike windows which due to entreprise commitments got bloated stuck shipping and supporting executables and dlls 10+ years old because they had no way to get rid of those (this is the biggest issue forced updates solve for MS - it far most cost-effective and profitable to just ship your latest code instead of grafting modern code into increasingly older codebases).

6

u/jabjoe Mar 03 '21

If you look at how Windows uses the disk, you will see.

C:/Windows/WinSxS is huge and it's contains a lot of duplicate libs. Different architectures and different versions. The moment many programs are installed, more load duplication. The system deliberately makes sure everything gets exactly the version of libs it was built for. It's all closed source, it can't be rebuilt to share versions.

Linux is all open source and everything is build and tested with the same version of each lib. Package management just nicely installs and updates this. The big win was the all open source.

8

u/whorememberspogs Mar 03 '21

Windows comes with a default amount of stuff they think the average user will need through the life of the computer

7

u/ThrowAway237s Mar 03 '21

Fun fact: Early versions of Windows such as 95 had a "minimal installation" mode, mainly targeted towards laptops.

0

u/[deleted] Mar 03 '21

[deleted]

1

u/ThrowAway237s Mar 03 '21

And CD-ROM's were over a hundred times faster.

4

u/[deleted] Mar 03 '21

Windows has, by default, a lot of stuff.. Linux does not. Moreover, a lot of you can install linux without too much gui and shave off a lot of megabytes. However, nomatter what you do it's hard to get below 500-700mb for a base install. So, it's not amazing, but still pretty amazing.

1

u/prone-to-drift arch|fedora Mar 04 '21

Well, puppy linux?

1

u/[deleted] Mar 05 '21

I've never thought of puppy Linux as a full blown distro. Could/would you use it as a daily driver?

2

u/prone-to-drift arch|fedora Mar 05 '21

I have more experience with it than most, I guess. I used it full time for an year alongside Ubuntu.

Our school didn't let us install things in the computer labs and it was a pain using Windows 7 there when I was used to Ubuntu at home back then. Bam, puppy linux on a pendrive, boots to ram, then you take the pendrive out and pass it to yoir friend and so on and in 10 minutes, there are 4-5 machines running puppy.

The experience was pretty decent. We had the tools we needed: a web browser (firefox), a text editor and a weird processor for making project reports, I think it shipped Abiword then. It was snappy AF but didn't look pretty. I loved the aesthetic though, and I was just starting to lose my fear of the shell in those days so it was nice to experiment there.

So. Yeah, I'd argue puppy is a usable distro and not just a gimmick.

1

u/[deleted] Mar 05 '21

That's good to know. I spent the last 10 minutes reading up on it. I guess you could change the gui to dwm and write some reports in vim, vi or emacs. However, I don't know what the sacrefice is to get it down to only 11mb. That's insane.

Ah wait wait.. Tiny Core was 11mb, Puppy is 300mb.

1

u/prone-to-drift arch|fedora Mar 05 '21

Oh wow that was a rollercoaster. I used puppy linux not dogsperm linux.

2

u/[deleted] Mar 05 '21

If there was a distro by that name, people would use it. It's like Hannah Montana Linux for men

4

u/MitchellMarquez42 Mar 04 '21

All of the above. The code of Windows tends to be a lot bigger than linux purely from a philosophical standpoint: It's in Microsoft's partner companies (Intel, Dell, HP, Lenovo, etc-- gaming companies too but a little less) interest to make people buy better hardware, and the best way to prove to someone that their hardware is bad is to show them something they can't do on it but want to. And if that's running windows, you have a customer who will loyally buy a new PC every 3 to 5 years because they genuinely believe that 8 GB of RAM (or is it 16 now?) really isn't enough to do anything in the modern world, and that 100 GB is a ridiculously small amount of space.

That sounds cynical so let's think of a slightly less mean reason.

Perhaps, because Linux uses shared libraries for applications rather than each bundling their own (all the things in /lib instead of DLLs in every folder with an EXE, which is probably all of them), the file-access overhead really is that much less. And also NTFS with its denser file packing means that most edits cause fragmentation which creates additional headers that take up a little space whereas linux (EXT4) just puts wider gaps between files so they don't hardly ever fragment. And the kernel is a lot more efficient because UNIX is simply a sturdier base than DOS.

But mainly the first reason.

14

u/pramodhrachuri Mar 03 '21

The first thing is that Linux provides just the kernel. No UI and extra libraries. The whole kernel is around 100 MB AFAIK.

2nd thing. The kernel is so small because they use a technique called code reuse to reduce redundant parts.

3rd. As others mentioned, the installation size depends on the distributions. I have seen installations that occupy 3 DVDs.

12

u/Human_by_choice Mar 03 '21

Funny thing I came to think of: Windows comes with a Linux kernel bundled with it. Just goes to show how much windows includes by default - while Linux philosophy is usually the opposite, to keep things minimal.

1

u/pramodhrachuri Mar 04 '21

No! Windows doesn't come bundled with Linux. It gets installed seperately. But yeah... You are right about the philosophy.

0

u/Human_by_choice Mar 04 '21

YES! Windows comes bundled with a modified version of the Linux kernel.

3

u/happymellon Mar 04 '21

I don't believe it does.

You can get the WSL, but that downloads the kernel. It isn't bundled.

2

u/Human_by_choice Mar 04 '21

Part of a windows update since may 2020, a bit unsure of date.

So in that sense it is bundled with windows.

3

u/happymellon Mar 04 '21

Looking at it I just see that it adds the Hyper-V hooks for WSL2.

You have to enable the flag in Windows and then download your distro. It doesn't come bundled with Windows.

2

u/Human_by_choice Mar 04 '21

Seems this got changed somewhere along the line: https://devblogs.microsoft.com/commandline/wsl2-will-be-generally-available-in-windows-10-version-2004/

13 Mar 2020 — We've removed the Linux kernel from the Windows OS image and instead will be delivering it to your machine via Windows Update

1

u/happymellon Mar 04 '21

Perhaps I read that differently, but that to me does not say it is being bundled, but updates will be delivered via Windows Update after you installed it.

1

u/Human_by_choice Mar 04 '21

Read what I said, cause that is what I said.

They first announced the kernel to be included in Windows 10 Update in May 2020 - later went back on this to what you said, deliver it through windows update but not bundle it by default.

→ More replies (0)

6

u/[deleted] Mar 03 '21

97mb, actually. Kinda surprised. I was pretty sure it was way less. Perhaps that's when the package is downloaded but not the installed size :) Still insane though.

Oh, I'm sure you could go way lower if you compiled your own kernel, but it does take some time and there's not much gained by doing so.

7

u/DeathByChainsaw Mar 03 '21

Yes you can compile a smaller custom kernel if you leave out kernel modules you don't plan on using, but mainly you only benefit from this with low-power embedded devices).

2

u/[deleted] Mar 03 '21

I've only tried a few times and didn't have a lot of luck, but I was pretty sure you'd be able to slim it down a lot when dropping a lof of the hardware support? For some reason I have the number ~40mb in my head. Not sure why.

1

u/aschanna123 Mar 04 '21

Maybe because there's Damn Samll Linux, which is 50 mb total.(Stripped kernel, zero bloat)

0

u/[deleted] Mar 04 '21

[deleted]

1

u/mikechant Mar 04 '21

4.7GB for a normal single layer DVD.

7

u/Se7enLC Mar 03 '21 edited Mar 03 '21

Why does Linux take much less storage space that Windows?

It doesn't.

Some distributions of Linux may, with default settings, install and take up much less storage space than a default installation of Windows.

But there are a lot of different distributions of Linux, and a lot of different things you might choose to install or not install. I have a copy of Linux running off a 10MB ramdisk on an embedded ARM processor in an FPGA. I have another copy running on a xeon server with hundreds of GB of software installed.

6

u/insane131 Mar 03 '21

I'll agree with that. Because Linux is built from lots of different software packages, it is very modular. You can strip out a lot of stuff or include everything but the kitchen sink (actually that may be available on github). Windows is not nearly as modular (although I think Microsoft has taken steps to improve that).

My x86 OpenWrt install weights in at about 150MB including the kernel - and that's a pretty large install.

Just the kernel + modules (I build them all) on my desktop eats up about 260MB. Then I have gigabytes of crap installed to make it a functional system.

Also, as noted earlier, a lot of people forget that Windows stores the hibernation file and swap file on the boot partition. I *think* a lot people still run a swap partition on Linux, so it doesn't get counted. In addition, I *think* Linux hibernates to the swap file/partition instead of using a separate file.

5

u/brimston3- Mar 03 '21

Also, windows has RAM or swapfile allocated for every page of virtual memory address space. This is the equivalent of vm.overcommit_memory = 2 (no overcommit allowed) on linux. The default on linux is to allow overcommit (malloc never fails) until the page is faulted in, and then it is allocated a RAM or swap page. So that swap file on windows can grow really huge even though it is storing almost nothing or never accessed.

6

u/[deleted] Mar 03 '21

One of the key reasons is that libraries on the UNIX type systems are shared. Libraries in our NT type system are often shipped with a package, because the developers could not agree on the standard versions of said libraries. As a result, the windows registry mixes and matches library versions to executables, so that at least one working combination can be put together. On UNIX however, mandated regular updates, POSIX compliant libraries, and because of the open source nature of the most popular spin-off of you Unix, almost all libraries can be shared. Flatpack, by the way, reverses all of our goodness, and half mandates that the libraries be shipped with the executables.

3

u/YellowOnion Mar 04 '21

I think the only correct answer is black-magic and "don't touch this it might break things", and backwards compatibility, I've found 16bit execs in my Windows 64bit 7 installation, despite Windows 7 having no support for old 16bit execs.

3

u/[deleted] Mar 04 '21

Even text files are bloated in Windows. They have a carriage return and line feed instead of just a line feed. Rumor has it that every function in Windows checks for whether it requires a reboot, but it does them all inline for better performance...

3

u/nemo-nowane Mar 04 '21

Because it Reduce, Reuse, Recycle. Also it is told, "Keep it simple, stupid"

3

u/elnezah Mar 04 '21

Like other said, because Windows programs pack all features and Linux programs don't, what they can share with others, they share. So you only have ONE video decoder or encoder for the whole Linux, instead of one for Media Player, another for Google Chrome, another for Firefox and so on. It would be like having one power supplier for each appliance in your house, instead of one for the whole house that powers all the appliances.

Another pro of this is that you update ONE video player and all your programs will be able to use the new features.

2

u/pramodhrachuri May 09 '21

Damn! I never thought of this

5

u/[deleted] Mar 03 '21

Because in windows most apps come packaged with their own dependencies while in linux all apps use the dependencies already present in the system.

2

u/findwho Mar 04 '21

Noticed some fanboys down-voting every comments containing "Windows takes less space". For any healthy and civilized discussion this is not good.

Bloatware on any platform is BAD, we managed to reach the Moon and back with just 4KB of RAM. And Billy the Gates thought 640KB is more than enough for any one.

As many have pointed out, the number of dependencies are ridiculously high;

e.g Telegram Desktop Flatpak is 870MB download and require 2.8GB diskspace, whilst direct linux download is 34MB and require approx 100MB diskspace.

Based on recommended system resources and minimal storage requirements, operating systems like QNX-RTOS, HaikuOS, AmigaOS are good examples of efficient programming and OS design principles.

4

u/[deleted] Mar 03 '21

They gotta add all the telemetry somewhere, right?

3

u/0x0ptyx Mar 03 '21

Windows is created for the non-technical every day user. This requires a lot of fluff to protect the user from doing something that would jeopardize their system and to make the system easier to use.

2

u/imvisaac Mar 04 '21

Less trojans Simply

1

u/CloroxEnergyDrink_ Mar 04 '21

Windows software is notorious for being heavily bloated, and it is largely because of compatibility reasons as well as use of full, highly specific third party device drivers. Linux drivers on the other hand are way more universal. Windows also installs more troubleshooting software by default along with a lot of unnecessary programs.

1

u/[deleted] Mar 04 '21

Also page and sysfiles in Windows are huge.

1

u/[deleted] Mar 03 '21

something else :)

1

u/thefanum Mar 04 '21

It's just better made across the board

1

u/JohnSane Mar 04 '21

The better question is: Why does Windows take so much space?

0

u/JonathanVQP Mar 03 '21

Since the Windows XP source code leak, Windows has become bloated and is built on top of each version. For example you can find Windows xp code in Windows 7 and above. Windows 10 has become a bloated mess but I still use it. Depending on how many packages you install and whether you want to install KDE or Gnome or not, Linux can run great even on old hardware since it is very lean.

-6

u/findwho Mar 03 '21

Mint 20.04 system takes 14GB of space(default installation), you may think this is less than Windows, nope, Windows 7 Professional takes about 8.1GB. (not sure about Windows 10).

wait till you start installing "snap" packages on ubuntu derivatives.... these are disk space hogs and have become bloatware with so many dependencies.

without snap, applications sometimes break when upgrading the dependency libraries.

14

u/[deleted] Mar 03 '21 edited Mar 03 '21

W10 takes ~40GiB. W7 is not a good example as it's deprecated, compare it with a distribution from the same age, most of them will take less storage. Also you don't have to use snap on Ubuntu (luckily), i got some laptop with Kubuntu 20.04, snap was erased as soon as i could open a terminal.

1

u/[deleted] Mar 04 '21 edited Mar 05 '26

[removed] — view removed comment

2

u/pramodhrachuri May 09 '21

What spyware did you remove?