1. Which command lists all available block devices like disks and partitions?
lsblk shows information about all storage devices such as disks, partitions, and mount points. It’s a quick way to check attached drives and where they are mounted.
lsblk
Get the Preplance app for a seamless learning experience. Practice offline, get daily streaks, and stay ahead with real-time interview updates.
Get it on
Google Play
4.9/5 Rating on Store
Linux & Shell Scripting · Question Set
Storage, Backup & Mount Management interview questions for placements and exams.
Questions
14
Included in this set
Subject
Linux & Shell Scripting
Explore more sets
Difficulty
Mixed
Level of this set
Go through each question and its explanation. Use this set as a focused practice pack for Linux & Shell Scripting.
lsblk shows information about all storage devices such as disks, partitions, and mount points. It’s a quick way to check attached drives and where they are mounted.
lsblk
For complete preparation, combine this set with full subject-wise practice for Linux & Shell Scripting. You can also explore other subjects and sets from the links below.
umount safely detaches a mounted filesystem. Always close open files and change directories before unmounting to avoid data loss.
sudo umount /mnt/data
df -h (disk free) shows available and used space for each mounted filesystem. The -h option formats the output in human-readable units like MB or GB.
df -h
du (disk usage) displays the size of directories and files recursively. It’s helpful to locate which directories consume the most disk space.
du -sh * | sort -rh | head
gzip compresses files efficiently to save space. Use gunzip or gzip -d to decompress them when needed.
gzip largefile.log
rsync transfers files locally or between remote systems efficiently. It copies only changed parts, making it ideal for backups and incremental syncs.
rsync -av /data /backup/
First, identify the drive using lsblk or blkid and note its UUID. Then add an entry in /etc/fstab specifying the UUID, mount point, and filesystem type. Run mount -a to verify before rebooting.
UUID=abcd-1234 /mnt/data ext4 defaults 0 2
Use rsync or tar to perform daily backups of key directories like /etc, /home, and /var. Automate the process with cron and store backups on an external drive or remote storage. Always test restore procedures regularly.
rsync -av /var/www /backup/webdata/
Use the tar -xzf command followed by the backup filename to extract files. You can specify -C to choose a target directory for extraction. Always check file permissions after restore.
tar -xzf backup.tar.gz -C /restore/
Use the smartctl command from the smartmontools package to view detailed disk health information. It reports temperature, bad sectors, and performance warnings, helping detect failing drives early.
sudo smartctl -a /dev/sda
Use du and find commands to locate large files, then manually delete or archive them. You can automate this cleanup using a shell script scheduled via cron for periodic maintenance.
find / -type f -size +500M -exec ls -lh {} \;The mount command attaches a filesystem to a specific directory so its data becomes accessible. Unmount it later using umount when no longer needed.
sudo mount /dev/sdb1 /mnt/data
The /etc/fstab file contains entries for all filesystems that should mount automatically during boot. Each line specifies the device, mount point, filesystem type, and mount options.
/dev/sdb1 /mnt/data ext4 defaults 0 2
tar is used to group multiple files or directories into one archive file. It’s often used with gzip for compressed backups, using the -czf option.
tar -czf backup.tar.gz /home/user/