How To Backup Linux File System?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/backup-linux-file-system/
PINTEREST
PINTEREST
INSTAGRAM

Linux is stable operating system. There is rare strong operating system foundation. But critical errors have occurs rarely too. Or they me be some hardware related problems. If your Linux system got down where your database resides what will happen? If you have backup is not so big problem. We can simple recover from backup. What if we have no backup?

Backup Partition With dd

dd is very useful tool. It is simple operation is convert and copy but this function can be used for different purposes like back up.

  • dd operation requires root privileges so we use sudo
  • if=/dev/vda1 is input file where vda disk first partition
  • of=/mnt/backup.dd  is out output file where we create new file named backup.dd

This operation will take some time because the whole partition will be backed up.

Backup Boot Loader (MBR) with dd

We can backup our boot loader sectors easily with dd. As we know dd work in raw mode so it only knows sectors and segments and Master Boot Records resides in first 512 byte we can use dd. This backup can be useful if we will install Windows or other operating system other partitions and do not want to lose our MBR

  • if=/dev/sda is disk where MBR resides
  • of=/mnt/mbr.bak is our backup file
  • bs=512 provides how many byte will be read at once
  • count=1 specifies how many time will the read operation done
LEARN MORE  How To Set Locale In Linux?

With bs and count parameter we want to read 512 byte for one time

We can recover our backup like below

As you see we have changed the input and output files.

Some Tips

To continue even copy operation has error we can provide conf=noerror parameter.

To sync without buffering data with dd sync operation can be used.

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/backup-linux-file-system/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)