Showing posts with label ext2. Show all posts
Showing posts with label ext2. Show all posts

Feb 3, 2014

Extended file attributes, ACL

Does file system support?
sudo tune2fs -l /dev/sda1 | grep "Default mount options:"
# Default mount options:    user_xattr acl
Extended file attributes

Extended attributes: the good, the not so good, the bad.
On Linux and FreeBSD, cp will only preserve xattrs if given the option --preserve=xattr, also implied by the -a option. cp will not duplicate attributes by default, which is a reasonable default choice, even if it will be wrong in some situations (where you will have to use the options).

Extended Attributes – lsattr and chattr
  • a : append only 
  • c : compressed 
  • d : no dump 
  • e : extent format 
  • i : immutable 
  • j : data journalling 
  • s : secure deletion 
  • t : no tail-merging 
  • u : undeletable 
  • A : no atime updates 
  • C : no copy on write 
  • D : synchronous directory updates 
  • S : synchronous updates 
  • T : top of directory hierarchy
lsattr test.txt
chattr -a test.txt
SELinux (англ. Security-Enhanced Linux — Linux с улучшенной безопасностью) — реализация системы принудительного контроля доступа, которая может работать параллельно с классической дискреционной системой контроля доступа. Входит в стандартное ядро Linux. Также для функционирования SELinux требуются модифицированные версии некоторых утилит (ps, ls, и тд), которые обеспечивают поддержку новых функций ядра, и поддержка со стороны файловой системы.
setfattr -n user.comment -v "this is a comment" testfile
getfattr testfile
# user.comment
getfattr -n user.comment testfile
# user.comment="this is a comment"

POSIX Access Control Lists on Linux
DAC model
man 5 acl
getfacl dir
setfacl -m user:joe:rwx dir
man chacl

Jan 23, 2014

Linux kernel. Devices and drivers

cat /proc/partitions
cat /proc/devices

tmpfs
df -h # tmpfs and subfolders v
udev
ps aux | grep [u]dev  # demons
udevadm monitor  # new devices

struct gendisk
add_disk()

struct block_device
struct block_device_operations
struct request_queue
struct request

sumit_bio()
generic_make_request

Linux I/O Scheduler
struct elevator_ops
vfs_ioctl() - call filesystem specific ioctl methods
man 2 ioctl # control device

I/O ports and I/O memmory vs DMA
IOMMU
cat /proc/ioports
cat /proc/mem
struct device
struct bus_type
bus_register()

sysfs vs Kernfs introduced in 3.14
ll /sys/block
ll /sys/bus/pci/

ISA, PCI, PCI Express

struct pci_bus
struct pci_dev
struct pci_driver




Vfs
struct inode
struct inode_operations
dmesg|grep Inode
#[    0.001283] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes)

struct file_struct - opened by process

struct file
struct file_operations

RCU

struct dentry
struct dentry_operations

NFS, AFS, SMB (CIFS)

struct super_block

mount
ll /dev/disk/by-*

ramfs, tmpfs, sysfs, procfs, debugfs CONFIG_DEBUG_FS
cat /proc/filesystems
ll /proc/buddyinfo
cat /proc/buddyinfo
cat /proc/slabinfo
sudo cat /proc/slabinfo
cat /proc/vmstat
cat /proc/kallsyms
ll /proc/kcore  # + gdb, ddd
cat /proc/interrupts

sys_open() - adds fd to current->fs
ACL
Ext2 reservation window


Ext3
writeback, ordered, journal