Sep 30, 2008
Difference between Soft and Hard links
1. Soft links are links to a file but not the inode.
2. To create: ln -s file1 file2
3. To view: ls -li
131135 lrwxrwxrwx 1 user user 5 Jul 10 09:04 file2 -> file1
131137 -rw-r--r-- 1 user user 35 Jul 10 09:03 file1
4. The inode for file1 is 131137 and inode for file2 is 131135.
5. If you see the permission bits, there is 'l' in the front for a soft link.
6. If file1 is deleted, the link still exists. But if you try to view file2, its empty. This means that once the main file is deleted the data is gone.
Hard Link:
1. Hard links are links to inode
2. To create: ln file1 file2
3. To view: ls -li
131136 -rw-r--r-- 2 user user 48 Jul 10 09:27 file1
131136 -rw-r--r-- 2 user user 48 Jul 10 09:27 file2
4. The inode for file1 and file2 is the same (131136).
5. If you see the output above for "ls -i", file2 does not show that it is linked to file1. In reality it is not linked to file1 but it is linked to the inode.
6. If you see that there is number '2' before the username 'user'. This shows the number of hard links to the inode.
7. If file1 is deleted, the data is not deleted. If you view file2 the data is still there. Deleting file1 only deletes a link. The data is gone once the last hard link is deleted.
Sep 10, 2008
To create iso's from a directory using mkisofs
mkisofs -L -l -allow-lowercase -allow-multidot -input-charset=cp437 -max-iso9660-filenames -joliet-long -N -v -d -R -o /destination
Jan 25, 2008
In order to use disk quotas, you must first enable them. This process involves several steps:
- Modifying /etc/fstab
- Remounting the file system(s)
- Running quotacheck (quotacheck -avug)
- Assigning quotas (edquota)
- Viewing quota usage (repquota
)
Lets look at the detailed steps:
You'll need to add the usrquota option to the /etc/fstab file to let it know that you are enabling user quotas in your file system.
/dev/md0 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
LABEL=/home /home ext3 defaults,usrquota,grpquota 1 2
In this example, we can see that the /home file system has both user and group quotas enabled.
At this point you must remount each file system whose fstab entry has been modified. You may be able to simply umount and then mount the file system(s) by hand, but if the file system is currently in use by any processes, the easiest thing to do is to reboot the system.
Running quotacheck
The quotacheck command examines quota-enabled file systems, building a table of the current disk usage for each one. This table is then used to update the operating system's copy of disk usage. In addition, the file system's disk quota files are updated (or created, if they do not already exist).
In our example, the quota files (named aquota.group and aquota.user, and residing in /home/) do not yet exist, so running quotacheck will create them. Use this command:
quotacheck -avug
The options used in this example direct quotacheck to:
Check all quota-enabled, locally-mounted file systems (-a)
Display status information as the quota check proceeds (-v)
Check user disk quota information (-u)
Check group disk quota information (-g)
Assigning Quotas
Use the edquota command for this purpose.
# edquota -u
The above command will invoke the vi editor which will allow you to edit a number of fields.
Add the values for soft or hard limits.
and save it.
Getting quota reports - The repquota command lists quota usage limits of all users of the system. Here is an example.
# repquota /home