Chapter 15
ACCESSING LINUX FILE SYSTEMS
Block device naming:
TYPE OF DEVICE
DEVICE NAMING PATTERN
SATA/SAS/USB-attached storage
/dev/sda, /dev/sdb ...
virtio-blk paravirtualized storage (some virtual machines)
/dev/vda, /dev/vdb ...
NVMe-attached storage (many SSDs)
/dev/nvme0, /dev/nvme1 ...
SD/MMC/eMMC storage (SD cards)
/dev/mmcblk0, /dev/mmcblk1 ...
Disk partitions
# 1st partition on 1st disk
/dev/sdb1
# 3rd partition on 2nd disk
/dev/sdb3
# 1st partition on 1st disk:
/dev/nvme0p1
# 3rd partition on 2nd disk:
/dev/nvme1p3
Logical Volumes
LVM - Logical Volume Management
# Get size reports:
du -H
# -h reports in KiB units
# -H reports in SI units
lsblk
mount /dev/vdb1 /mnt/data
mount UUID="46f543fd-78c9-4526-a857-244811be2d88" /mnt/data
# shows mountpoints:
lsblk -p
# shows UUID:
lsblk -f
# how to mount:
mount /dev/vdb1 /mnt/data
mount UUID="46f543fd-78c9-4526-a857-244811be2d88" /mnt/data
# how to unmount:
umount /mnt/data
The lsof
command lists all open files and the process accessing them in the provided directory. It is useful to identify which processes currently prevent the file system from successful unmounting.
LOCATING FILES ON THE SYSTEM
The locate database is automatically updated every day. However, at any time the root user can issue the updatedb command to force an immediate update.
updatedb
locate passwd
locate -i messages
locate -n 5 snow.png
find / -name sshd_config
find / -name '*.txt'
find /etc -name '*pass*'
find / -iname '*messages*'
find -user user
find -group user
find -uid 1000
find -gid 1000
find / -user root -group mail
find /home -perm 764
find /home -perm -324
find /home -perm /442
find -perm -004
find -perm -002
find -size 10M
find -size +10G
find -size -10k
find / -mmin 120
find / -mmin +200
find / -mmin -150
find /etc -type d
find / -type l
find /dev -type b
find / -type f -links +1
Last updated
Was this helpful?