File System
To refresh the system with new partition
partprobe or partx -a /dev/xxx
To create filesystem
mkfs.ext4 /dev/sdb1
To run a filesystem check
fsck /frv/sdb1
To mount a filesystem:
First create a new directory
mkdir /directory
mount -t ext4 /dev/sdb1 /directory
To unmount
umount /directory
To add a swap space on a new partition
First
mkswap -L NEWSWAP /dev/sdb2 swapon -L NEWSWAP
Then, add an entry on fstab
LABEL=NEWSWAP swap swap defaults 0 0
To setup a user quota
1. Edit fstab,
2. Add usrquota beside defaults
3. mount the partition:
mount -o remount /home
4. Create a userquote file:
quotacheck -cum /home
5. Create username
quota: edquota -u username
6. set a quota:
setquota -u username 30000 35000 0 0 /home
7. Turn on the quota:
quotaon /home
To copy user quota settings
edquota -up username1 username2
To setup a group quota
1. Edit fstab, add grpquota
2. Create a group quota file:
quotacheck -cgm /sales
3. Set a quota:
setquota -g grpname 30000 35000 0 0 /sales
4. Turn on the quota:
quotaon /sales
To view quota usage:
edquota -g sales
To view quota statistic
repquota -ga (for group) repquota -a (for users)
To create a dump file
dd if=dev/zero of=filename bs=1024 count=25000 (~25MB)
To view an inode
ls -li filename
To create a hard link (cannot cross disk device)
ln filename Desktop/filename-link
To create a symbolic link (can cross disk device)
ln -s /full-path/filename /full-path/filename-link
To setup an ACL
1. Edit fstab,
2. Add acl beside defaults
To view acl:
getfacl /directory
to set acl:
setfacl -m u:username:x /home/directory/
to remove acl:
setfacl -x u:username: /home/directory/