Loop devices and filesystems
Hi all,
I still don't really understand the concept of loop devices, especially why were they needed when creating and using the partition table on a file, that was in chapter 17 if I recall correctly?
Only after using losetup and asking it to scan the partition table do we get separate loop devices for all partitions, but is that the only way to get a device file for every partition? Why couldn't the file containing the filesystem simply have device files for all it's partitions like i. e. /dev/sda has?
Comments
-
Hi @vbeljan ,
I still don't really understand the concept of loop devices, especially why were they
needed when creating and using the partition table on a file, that was in chapter 17 if I recall correctly?The idea of using loop devices is to be able to play with the partitioning tools like parted, fdisk, gparted, without the need of having real partitions. Now that we have virtual machines, we can easily create virtual disks to play with partitions.
Only after using losetup and asking it to scan the partition table do we get separate loop devices
for all partitions, but is that the only way to get a device file for every partition? Why couldn't the file
containing the filesystem simply have device files for all it's partitions like i. e. /dev/sda has?I don't understand this question. Did you take a look to Lab 17.3? Is that what you were asking?
Regards,
Luis.0 -
On one point, even the nodes for real physical devices (like /dev/sda and particitions /dev/sda1, sda2, etc) exist only when the partitions exist and are discovered by the system. So it makes no sense to predefine loop devices, it is all dynamic.
0 -
I don't understand this question. Did you take a look to Lab 17.3? Is that what you were asking?
Regards,
Luis.Hi, sorry if it was a bit unclear. What I wanted to know is this: If we made a partition table in a file like in lab 17.3 and we wanted to have files in /dev that represent specific partitions on it (like /dev/loop0p1, /dev/loop0p2, etc when using losetup), would it be possible to create such files/nodes for the partitions in some other way without using losetup and loop devices?
0 -
Hi @vbeljan ,
I'm not aware of a different way to make partitions from a file than using loop devices and losetup. When I'm confused about a tool, I use to look for additional documentation and examples, so I try and test until I understand it.
Many regards,
Luis.1 -
you could make the nodes in /dev by using "mknod". However, this is the ancient way of doing things which has been obsolete for many years since dynamical allocation by the udev system (discussed later) has been the norm. ANd if you make them manually I cannot promise they will work as expected
1
Categories
- All Categories
- 177 LFX Mentorship
- 177 LFX Mentorship: Linux Kernel
- 769 Linux Foundation IT Professional Programs
- 379 Cloud Engineer IT Professional Program
- 175 Advanced Cloud Engineer IT Professional Program
- 75 DevOps IT Professional Program - Discontinued
- 7 DevOps & GitOps IT Professional Program
- 102 Cloud Native Developer IT Professional Program
- 7.6K Training Courses & Learning Paths
- 7 AI & ML Training
- 1 Blockchain & Decentralized Identity Training
- 15 Cloud & Containers Training
- 2 Cybersecurity Training
- 2 DevOps & Site-Reliability Training
- 1 Linux Kernel Development Training
- 2 Networking Training
- 2 Open Source Best Practice Training
- 4 System Administration Training
- 1 System Engineering Training
- 2 Web & Application Development Training
- 796 Hardware
- 202 Drivers
- 68 I/O Devices
- 37 Monitors
- 95 Multimedia
- 173 Networking
- 91 Printers & Scanners
- 91 Storage
- 771 Linux Distributions
- 81 Debian
- 68 Fedora
- 23 Linux Mint
- 13 Mageia
- 24 openSUSE
- 151 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 356 Ubuntu
- 465 Linux System Administration
- 31 Cloud Computing
- 73 Command Line/Scripting
- Github systems admin projects
- 98 Linux Security
- 78 Network Management
- 101 System Management
- 46 Web Management
- 126 Mobile Computing
- 20 Android
- 91 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 400 Off Topic
- 124 Introductions
- 32 Study Material
- 1K Programming and Development
- 310 Kernel Development
- 705 Software Development
- 1K Software
- 407 Applications
- 182 Command Line
- 5 Compiling/Installing
- 70 Games
- 318 Installation
- Archived
- 183 Small Talk
- 2 LFD140 Class Forum
- 1.4K LFS258 Class Forum
Upcoming Training
-
August 20, 2018
Kubernetes Administration (LFS458)
-
August 20, 2018
Linux System Administration (LFS301)
-
August 27, 2018
Open Source Virtualization (LFS462)
-
August 27, 2018
Linux Kernel Debugging and Security (LFD440)
