Logo/

Storage and File System Concepts

Log in

Made with ScholarlyMake flashcards like these from your own notes

Storage and File System Concepts

Questions and answers

29 cards
  1. Question:What are persistent storage devices used for persistent data storage?

    Answer:Hard disk drives and solid-state storage devices.

  2. Question:What are the main abstractions on storage?

    Answer:File, directory, and file system.

  3. Question:How is a file defined in terms of abstraction?

    Answer:A linear array of bytes.

  4. Question:What are the key differences between a file and a process address space?

    Answer:Files have variable length, are persistent, and discontinuous on hard disk, while process address spaces have fixed length, are volatile, and continuous in physical memory.

  5. Question:What is a commonality between files and process address spaces?

    Answer:Both files and process address spaces can be shared across processes.

  6. Question:What is the role of the file system in providing file abstraction?

    Answer:The file system is a kernel mechanism that provides file abstraction by persistently managing files on disk, mapping files to physical disk regions/blocks, and hiding the exact storage location from users.

  7. Question:What is the difference between a file and a directory?

    Answer:Files contain actual data, while directories contain lists of files and sub-directories; directories are also a type of file but do not contain any data of their own.

  8. Question:What are the main attributes (metadata) of a file?

    Answer:Name, type, location, size, owner, and protection.

  9. Question:What data structure in the kernel stores file metadata?

    Answer:File control block (FCB) or inode (in UNIX-like systems).

  10. Question:What is partitioning a disk?

    Answer:Dividing a physical disk into multiple areas, each of which can have a separate file system configured.

  11. Question:Why should the FCB (File Control Block) exist in storage?

    Answer:The FCB should exist in storage to maintain file metadata (attributes, location, size, etc.) persistently, ensuring that this information is available even when the file is not actively being accessed or when the system restarts.

  12. Question:In Linux, what system calls are typically used to start and end a file operation?

    Answer:File operations in Linux typically start with the open system call and end with the close system call.

  13. Question:Describe the process of file creation in Linux using the open system call, including the flags involved and the returned value.

    Answer:File creation involves calling the open system call with the O_CREAT flag (e.g., open("fookuos.log", O_CREAT | O_WRONLY | O_TRUNC)). O_CREAT creates the file if it doesn't exist. O_WRONLY allows writing to the file. O_TRUNC initializes the file, removing existing content if it exists. The function returns a file descriptor (fd), which is an integer used to access the opened file.

  14. Question:Explain the purpose and parameters of the read and write system calls in file operations.

    Answer:read(fd, buffer, length) reads up to length bytes from the file descriptor fd into the memory location pointed to by buffer. write(fd, buffer, length) writes up to length bytes from the memory location pointed to by buffer to the file descriptor fd.

  15. Question:What is the current-file-position pointer, and how does it change during read and write operations?

    Answer:The current-file-position pointer keeps track of the current location in a file where read and write operations will occur. It increases implicitly by the number of bytes read or written. It can be explicitly moved using the lseek system call.

  16. Question:Describe the evolution of directory structures from early single-level directories to tree structures, highlighting the advantages of the latter.

    Answer:Early single-level directories were simple but inefficient and couldn't create subdirectories. Tree structures allow for arbitrary subdirectories, enabling better organization and management of files. Concepts like root path and current directory are also part of tree structures.

  17. Question:What are the two methods for sharing files across multiple directories in a file system, and what are their key differences?

    Answer:The two methods are copying and linking. Copying creates independent duplicates, while linking creates directory entries that point to the same file (hard link) or a path to the original file (soft link).

  18. Question:Explain how hard links work, including their relationship to inodes and the implications of deleting one of the linked filenames.

    Answer:A hard link is a directory entry that points directly to the inode of the original file. All hard links share the same inode and thus the same data. If one filename is deleted, the inode and data remain accessible through the other hard links, and the inode maintains a link count.

  19. Question:Describe how soft links (symbolic links) work and how they differ from hard links.

    Answer:A soft link (symbolic link) is a directory entry that contains the path to the original file. It has its own inode, separate from the original file's inode. If the original file is deleted, the soft link becomes broken.

  20. Question:Compare hard links and soft links in terms of data access speed and file size (as reported by ls).

    Answer:Hard links generally provide faster data access as they directly point to the inode. Soft links are slower because they must resolve the path to the original file. The size of a hard link entry is the same as any other file entry; the size of soft link will be the length of the path it resolves.

  21. Question:Explain the purpose of mounting devices to directories, and provide an example of how it achieves a unified structure.

    Answer:Mounting maps a device's partition to an existing directory, allowing different storage devices (HDDs, SSDs, USB drives, etc.) to be accessible via a unified directory structure. For example, a USB drive can be mounted to /mnt/usb, making its contents accessible through that directory.

  22. Question:What are the advantages of using a mounting mechanism in file systems, specifically concerning flexibility and scalability?

    Answer:Mounting allows users to access files on various devices as if they are part of the main directory hierarchy, providing flexibility. It also enables controlling a large number of devices (potentially hundreds) with a single directory tree, thus offering scalability.

  23. Question:Outline the steps involved in the mounting process, from determining a mount point to accessing the file system.

    Answer:1. Determine a mount point: Select an empty directory where the file system of the device will be attached. 2. Run mount command: Execute the appropriate command to mount the device's file system to the chosen directory (e.g., mount /dev/sda1 /mnt-1). 3. Access the file system via the mount point: The contents of the mounted device become accessible through the specified mount point.

  24. Question:How does mounting contribute to implementing a distributed file system efficiently?

    Answer:Mounting can be extended to multiple machines in a distributed file system. Each machine's storage device is mounted to a central directory, providing unified access to storage spread across different machines.

  25. Question:Explain the concept of file ownership and its purpose in protecting stored data.

    Answer:File ownership is a protection mechanism that prohibits unauthorized access to stored data. It's abstracted at the file level, including user, group and other.

  26. Question:How are the initial user and group owners determined when a file is first created, and how can ownership be changed?

    Answer:When a file is first created: 1. User: The account that created the file. 2. Group: The group to which the user belongs. Ownership can be changed using the chown command.

  27. Question:Describe the three basic types of file permissions and their respective functions.

    Answer:The three types of file permissions are: 1. Read (r): Allows reading the data inside the file. 2. Write (w): Allows writing data inside the file. 3. Execute (x): Allows executing the file as a process.

  28. Question:For whom are file permissions set, and provide an example of how to set permissions using the chmod command.

    Answer:File permissions are set individually for the owner, group, and others (public). For instance, chmod 761 test.log sets full permissions for the owner, read-write permissions for the group, and execute permission for others.

  29. Question:Explain the permissions set by chmod 761 test.log for the owner, group, and others.

    Answer:The command chmod 761 test.log sets the following permissions: * Owner (7): read (4) + write (2) + execute (1) * Group (6): read (4) + write (2) * Other (1): execute (1)