Hello, apparently hanging out in Lemmy inadvertently makes you thinking about using Linux. I am planning to install Linux Mint cinnamon on an older laptop, which I want to bring to LAN Parties. From what I read I can just format my C:\ windows disk, install Linux via bootable drive and from what I understand, proton is basically included when installing steam after setting up my new Linux OS? Thanks for your comments:)

  • KeenFlame
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    Okay thank you. I feel like it’s a lot of information here that is about, like you say, how complicated abstract and advanced it is, with the devices, kernel representations and mount points.

    There must be a better way of just explaining how the root fs works, because I still don’t understand anything.

    It really doesn’t feel like comparing it to windows gives any favours though, maybe explain use cases, like where would the user save downloads, where would you install apps?

    I’ve used Linux a little. Right now it’s modernized enough for me to not learn the file system. But I remember in old times when I ran Ubuntu I just crammed files in a folder and struggled a lot with it

    • TootSweet@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      Ok. Lessee.

      Just to quickly explain first off:

      • A disk is just a big collection of bytes. A 100GB disk has 100 billion(-ish) bytes. Each one has an index. The first byte has index “0”. The second has index “1”. There’s a byte 8,675,309. Each byte has a particular value at any one time. The computer can set the value of any byte to any value. (It could set byte 8,675,309 to 01100001 and later it can reliably be read back from the same index as the same value, until it’s changed to a different value.)
      • A disk can be divided into partitions. Basically you (or rather a tool you use) writes data to a location near the beginning of the disk that says “treat this disk as multiple separate devices. The first starts at byte X and ends at byte Y, the second starts at Y and ends at Z, etc.”
      • When you plug a disk into a Linux computer (on most modern full-featured desktop/laptop Linux systems, though maybe not on, for instance, some embedded systems) a new “file” appears in /dev for the disk along with more files for each of the partitions on the disk. For instance, an external USB hard drive with three partitions might show up as /dev/sda and the partitions as /dev/sda1, /dev/sda2, and /dev/sda3 respectively. (Ok. Technically the things in /dev are only files in some senses. They’re technically “devices”. But they have paths like files do and they can be read from and written to like files.)
      • If you want to, you can read and write to those partitions or to the disk directly as you would read or write any file. You can open it in a text editor, for instance. You might get lots of random-looking broken characters if you do that, and god help you if you try to save over it, but you can. If you read from a disk or partition, it just returns all the bytes in the disk or partition starting from the first (or from whichever index your application asks it to start from.)
      • A “filesystem driver” knows how to interpret the bytes on a partition as files and directories.
      • If you want to know what device in /dev a file lives on and what filesystem driver is used for that device, the mount command just typed into any bash terminal will tell you. It’ll output rows like on type (...). If you read/write a file or list a directory, it’ll pick the entry in the mount output that has the longest that is a prefix of the requested file. The is the “file”(/device) in /dev that corresponds to the parition on which that file is encoded. `` is the name of the filesystem driver. So, for instance, if I have an entry /dev/sdb3 on /mnt/pringles type ext4 (...) and I read a file named /mnt/pringles/apple/unicorn/potato.txt (and if there are no entries in the mount output with longer paths that are still prefixes of the requested file path), the kernel will ask the ext4 filesystem driver to please look at the partition /dev/sdb3 and interpret that partition’s contents as a hierarchical filesystem to find and return the contents of the file at the path apple/unicorn/potato.txt relative to the root of the filesystem encoded on the /dev/sdb3 partition.
      • There are other filesystem drivers that don’t deal with disks. Some like tmpfs store data in RAM only (and RAM isn’t intended to be persistent, so you can’t expect anything in a tmpfs to last reliably through a reset.) Others like procfs don’t look at a disk but make these ephemeral files that basically decide what data to return when read from at the time they’re read from. (Files in procfs filesystems usually expose data about the Linux system. Like, for instance, what processes are currently running.)

      Now, the question of where files should go is… kinda unrelated to the above. Files that are system-wide configuration should go in /etc. Files that are system-wide executables should generally go in /bin, /sbin, /usr/bin, /usr/sbin, and /usr/local/bin. Anything your own user downloads/creates should go in /home/$username. Etc. More specifics of all this here.

      It can be useful to make decisions regarding what disk/partition a particular directory like /home lives on. But whether /home is on the same partition with /etc and /bin and /var etc or whether it’s on a different partition (and both of these options are quite common), your users’ files should go somewhere in /home.

      To elucidate a little more, if you decide to put your /home on the same partition as /bin and /etc and /var and such, you’ll have an entry in your mount output like /dev/sda2 on / type ext4 but nothing with a `` of /home. If you decide to put /home on a separate partition, you’ll have your /dev/sda2 on / type ext4 entry plus another entry like /dev/sda3 on /home type ext4.

      So which partition does a file go on when you write a file to /home/keenflame/document.txt? Well, in the first case, it’d be on the partition Linux calls /dev/sda2. In the second case it would be written to the partition that Linux calls /dev/sda3.