LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-16-2015, 12:14 AM   #16
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,613

Rep: Reputation: 433Reputation: 433Reputation: 433Reputation: 433Reputation: 433

Quote:
If you rsync a directory where an image might reside, it mirrors that directory but does it include boot ability?
Answer: No.
What you rsynced was a directory, not the boot sector.

Quote:
If you archive the file or directory, with tar, does it preserve its bootable qualities?
Answer: No.
What you archived was again a file or directory.

Although this is not a problem, for the sake of the question I'll try to give a brief helpful answer.

The filesystem consists of booting blocks and then followed by the data blocks (commonly referred to as volumes). For security purpose basic file handling commands you mention above, rsync and tar, are aimed mainly at the latter blocks, the volume, where all data of files and directories are stored. Thus, consequently only these aspect of the filesystem is handled and done accordingly at command success.

To copy both, the booting blocks and data blocks you need to handle the two block sectors separately if you must need use rsync or tar. E.g. use "dd" to handle the bootsectors
Code:
 dd if=/dev/<yourdevice> of=mybootblocks bs=1024 count=1
keep this file into a separate device or filesystem for safety. Then you can rsync the rest of the volume blocks, all files and directories for safe keeping too.

To restore the files unto the same device, in case of crisis:
Code:
 dd if=mybootblocks of=/dev/<mydevice-in-SOS>
then next step is to rsync or untar the saved files and directories (data) to where they came from. Done.

That is for the method of backing the boot sectors coupled with rsync/tar on the data side. But the shortest way to back up the whole device is by simple use of "dd"
Code:
 dd if=/dev/<mydevice> of=mydeviceasofDecember.img bs=2048
To restore is by simple "dd" by inverting the items.

Hope that helps.

Good luck and enjoy.

m.m.
 
Old 12-16-2015, 12:27 PM   #17
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 2,957

Rep: Reputation: 1267Reputation: 1267Reputation: 1267Reputation: 1267Reputation: 1267Reputation: 1267Reputation: 1267Reputation: 1267Reputation: 1267
What the OP is trying to do and where the failure is occuring is about as unclear as can be. If you have a file that contains a bootable image, then you can copy that file from place to place, insert it into a tar archive, extract it from a tar archive, ... whatever, and the image file will be just fine. It's only when you create that image file from a bootable device or install that image on a device that you have to be concerned with what regions of that device are being saved or restored.

"Image" files come in many varieties. A true image file is just a bit-for-bit copy of the original device. That sort of file is typically created or installed by dd, though you can use cp or even cat as long as you use the device name (/dev/xxx). Tools such as clonezilla or partclone create files in their own, unique formats, and those files have to be installed by the same tool used to create them. All those files, once created, are just data files that can be copied, put into tar archives, etc., without affecting their content.
 
Old 12-16-2015, 01:06 PM   #18
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,599

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
Quote:
Originally Posted by malekmustaq View Post
Answer: No.
What you rsynced was a directory, not the boot sector.


Answer: No.
What you archived was again a file or directory.

Although this is not a problem, for the sake of the question I'll try to give a brief helpful answer.

The filesystem consists of booting blocks and then followed by the data blocks (commonly referred to as volumes). For security purpose basic file handling commands you mention above, rsync and tar, are aimed mainly at the latter blocks, the volume, where all data of files and directories are stored. Thus, consequently only these aspect of the filesystem is handled and done accordingly at command success.

To copy both, the booting blocks and data blocks you need to handle the two block sectors separately if you must need use rsync or tar. E.g. use "dd" to handle the bootsectors
Code:
 dd if=/dev/<yourdevice> of=mybootblocks bs=1024 count=1
keep this file into a separate device or filesystem for safety. Then you can rsync the rest of the volume blocks, all files and directories for safe keeping too.

To restore the files unto the same device, in case of crisis:
Code:
 dd if=mybootblocks of=/dev/<mydevice-in-SOS>
then next step is to rsync or untar the saved files and directories (data) to where they came from. Done.

That is for the method of backing the boot sectors coupled with rsync/tar on the data side. But the shortest way to back up the whole device is by simple use of "dd"
Code:
 dd if=/dev/<mydevice> of=mydeviceasofDecember.img bs=2048
To restore is by simple "dd" by inverting the items.

Hope that helps.

Good luck and enjoy.

m.m.
SOMETIMES that will work.

The problem is that the "boot blocks" include multiple separate blocks... and depend on what partitioning scheme (GPT doesn't store the blocks the same way).

In the MBR there are two separate areas... 1, the MBR itself (446 bytes or the newer 218 bytes for part 1 then in another area 216 or 222 bytes for part 2). then the extension area in the partition table...

So copying the boot blocks also requires copying the partition table.
Not always a good idea - as the target disk may have them in different places (4k block size? 1K blocksize? 2K?).
 
Old 12-16-2015, 04:13 PM   #19
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,374

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
We are getting off the OP's question I believe.
 
Old 12-16-2015, 09:11 PM   #20
Fred Caro
Member
 
Registered: May 2007
Posts: 999

Original Poster
Rep: Reputation: 166Reputation: 166
Yes that is what I thought
Quote:
A true image file is just a bit-for-bit copy of the original device
or file

and dd does that, warts and all.

What I got wrong was that .img files could be dd'd and then protected by putting them in an archive. It still has to be "read" by the other end, hence cloning being done by a tool that includes formats, the aggregate of which may not recognize the original.

Fred.

Last edited by Fred Caro; 12-16-2015 at 09:13 PM. Reason: missed bit out
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 03:48 AM
tar preserve permissions not working dhinged Linux - Newbie 1 03-22-2014 09:20 AM
Best way to preserve ownership in tar compress? dhinged Linux - Newbie 3 03-21-2014 06:22 PM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 03:53 AM


All times are GMT -5. The time now is 06:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration