LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Fault Backup try (https://www.linuxquestions.org/questions/linux-newbie-8/fault-backup-try-4175598001/)

M.sewaif 01-22-2017 06:52 AM

Fault Backup try
 
I`m a new Linux user, I have tried to backup the boot partition using " tar " command as below :
# tar -xf /dev/sda5 /mnt/boot_backup
unfortunately, after reboot I got the " grup rescue " shell & when tried to list any file system ( ls (hd0,msdos5)/grup2) I`m getting an error message " unknown filesystem"

finally I tried to extract the /mnt/boot_backup using Centos 7 DVD using the following command :
# tar -xvf /mnt/boot_backup /dev/sda5
but got the following error
tar: At beginning of tape, quitting now
tar: Error is not recoverable: exiting now

Please advice

syg00 01-22-2017 03:04 PM

Welcome. An unfortunate introduction to Linux.

Whilst getting an understanding of backups is exemplary, I see several problems:
- as per your second command, the "-x" option is to extract an already existing tar archive. Your first command should have used "-c" (create) instead.
- it is usually unnecessary (and often dangerous) to use device nodes directly - use mountpoint(s) for safety.
- tar archives are files - you need to specify the filename each time.

Perhaps something like the following would do what you wanted - note the order of parameters
Code:

tar -cf /mnt/boot_backup/boot_backup.tar /boot
As for your problem, I'm surprised that first command did anything at all, but it looks like it opened then closed the device node, and effectively emptied it. From the Centos liveDVD, run these to get some idea of what's what.
Code:

df -hT
ls /run/boot

On that second command, substitute as appropriate to get th on-disk boot partition listed.

M.sewaif 01-23-2017 01:46 PM

1 Attachment(s)
Thanks Dear for your replay

First of all, I had already executed the " tar " command with " cf " option not as mentioned in my previous post.

secondly, I have ran these two commands as per your advice and got the attached result.

Is it mean as you told that the device node for boot partition had been emptied ???

michaelk 01-23-2017 02:34 PM

In addition to what syg00 posted the correct syntax for tar is:

tar -cf /destination/file files_to_be_tarred

Which means you over wrote part of /dev/sda5 with the contents of /mnt/boot_backup. So what was sda5? Can you post the output of the command lsblk?

syg00 01-23-2017 04:32 PM

That output looks like the on-disk system, and doesn't show much. But it did boot.
As well as the "lsblk" output, let's see this
Code:

sudo mount /dev/sda5 /mnt
ls -al /mnt
sudo umount /mnt


M.sewaif 01-24-2017 07:05 AM

Dear SYG00 & Michealk
Thank for you interest , but unfortunately I have installed a fresh Centos 7image .
Can you please guide me to creat system state backup or restore point (I'm MCSE so may be these are microsoft expressions )

pan64 01-24-2017 07:26 AM

there is no "restore point" in the linux world - or at least it is not similar to the restore point used by MS-Windows.
You can use a lot of different tools to back up your system, but actually you may need to boot another OS (livecd) to be able to save the content of the root partition. dd can be used to do that, but without knowing your system (what to backup, where to) we cannot give you better answer.

M.sewaif 01-24-2017 07:56 AM

I forgot to tell that I'm using CentOS 7

pan64 01-24-2017 08:22 AM

no, you did not forget, that was mentioned in the first post


All times are GMT -5. The time now is 05:39 AM.