AllTechGurukul


Its Naveen's Wiki

fstab entries 0 0 what it will do

 In the /etc/fstab file on Linux systems, which is used for defining how filesystems are mounted at boot time, the last two numbers in each line represent the dump and fsck options. When you see 0 0 in an fstab entry, it means the following:

  • Dump: The first 0 indicates that the filesystem will not be backed up by the dump utility. dump is an old backup utility that is rarely used nowadays. Setting this value to 0 effectively disables backups for that filesystem using dump.

  • Fsck: The second 0 indicates that the filesystem will not be checked for errors at boot time using the fsck utility. fsck is a filesystem check utility that can repair errors on a filesystem. Setting this value to 0 means that the filesystem will not be automatically checked for errors during the boot process.

What it does:

When you have 0 0 in an fstab entry, it essentially means that the corresponding filesystem is not included in automatic backups using the dump utility and is not checked for errors at boot time using fsck.

When is it used:

This configuration is typically used for filesystems that:

  • Do not need to be backed up: For example, temporary filesystems like /tmp or virtual filesystems like /proc and /sys.
  • Are not critical for system operation: In some cases, you might have a non-critical filesystem that you don't need to check for errors at every boot.
  • Are handled by other tools: Some filesystems might be checked and repaired by other tools or mechanisms, so there's no need to check them with fsck at boot time.

Important Notes:

  • Root filesystem: The root filesystem (/) should never have a 0 in the fsck field. It is crucial to check the root filesystem for errors at boot time to ensure system stability.
  • Other critical filesystems: Other critical filesystems, such as those containing user data or important applications, should also have a non-zero value in the fsck field to ensure they are checked for errors at boot time.
  • Swap partition: Swap partitions usually have 0 0 in their fstab entries because they are not traditional filesystems and do not need to be checked for errors.

In summary, 0 0 in an fstab entry indicates that the filesystem is not backed up by dump and is not checked by fsck at boot time. This configuration is typically used for non-critical or temporary filesystems.


How to take backup using dump utility in linux fstab

While the dump utility is a traditional backup tool in Linux, it's not commonly used nowadays due to its age and limitations. However, if you still need to use it, here's how you can configure it with fstab:

1. Install dump:

Bash
sudo apt install dump  # On Debian/Ubuntu systems
sudo yum install dump  # On Red Hat/CentOS systems

2. Configure fstab:

In your /etc/fstab file, you need to set the dump field to 1 for the filesystems you want to back up using dump. For example:

/dev/sda1 / ext4 defaults 1 1
/dev/sdb1 /home ext4 defaults 1 2 

In this example:

  • The first line will be backed up by dump because the dump field is set to 1.
  • The second line will also be backed up, but it will be considered a different level for incremental backups (more on this later).

3. Using the dump command:

The basic syntax for the dump command is:

Bash
dump [options] [level] [file] [filesystem]
  • level: This is a number from 0 to 9, where 0 is a full backup and any other number is an incremental backup.
  • file: This is the name of the file where the backup will be stored.
  • filesystem: This is the filesystem you want to back up.

Examples:

  • Full backup:
Bash
sudo dump 0uf /path/to/backup.dump /dev/sda1

This will create a full backup of the /dev/sda1 filesystem and store it in the /path/to/backup.dump file.

  • Incremental backup:
Bash
sudo dump 1uf /path/to/backup.dump /dev/sda1

This will create an incremental backup of the /dev/sda1 filesystem, containing only the changes since the last full backup (level 0) or the last incremental backup of a lower level.

4. Backup levels and rotation:

dump uses a concept of backup levels to manage full and incremental backups. You can define different levels in your fstab file (as shown in the example above) and use them with the dump command.

A common backup strategy is to have a full backup (level 0) once a week and incremental backups (level 1 or higher) every day. You can then rotate your backups to have multiple sets of backups for different time periods.

Important notes:

  • Dump is outdated: As mentioned earlier, dump is an old backup utility with limitations. It might not handle large filesystems or complex backup scenarios efficiently.
  • Alternatives: Consider using modern backup tools like rsync, tar, or dedicated backup solutions, which offer more features and flexibility.
  • Documentation: Refer to the dump command's man page (man dump) for more detailed information and options.

Post a Comment

Previous Post Next Post