What is a block device in Linux?
A storage device that must be formatted before the file system can use it
Common examples include hard drives, which are stored in ‘/dev’.
What are the common devices in Linux storage?
Devices are identified in the ‘/dev’ directory.
What must be done to a partition before it can be used?
It must be mounted at a mount point
The first partition loaded upon boot is the root partition.
What is a logical volume in Linux?
A collection of block devices that appears as one partition
It is created from multiple block devices and is also viewable in ‘/dev’.
Which command is used to view information about partitions/volumes?
$df
Use ‘$df -h’ for human-readable sizes.
What command is used to mount a device in Linux?
mount
You can specify the device name or the UUID.
How do you manually mount the second partition on the first disk to /backup?
$sudo mount /dev/sda2 /backup
If the device is disconnected, it will unmount automatically.
What should you do before disconnecting a device?
Unmount the device
Use ‘$sudo unmount /backup’ to safely disconnect.
What command can be used to find which files are open on a mounted device?
$sudo lsof /backup
This command lists open files and their process IDs.
What is the purpose of the mlocate service?
Creates a database of files and paths every day
The command ‘locate’ searches this database.
What command is used to locate files in Linux?
locate
Use ‘$locate homework’ to find files containing ‘homework’.
What command is used for a real-time search of files?
find
It is slower but more accurate for frequently changing systems.
How do you find files owned by the user hector?
$find / -user hector
This command searches the entire file system.
What command would you use to find files larger than 5GB?
$find / -size +5G
This command searches the entire file system for large files.
To find files modified less than an hour ago, you would use:
$find / -mmin 60
This command searches for recently modified files.