LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-15-2022, 03:23 PM   #16
Tem2
Member
 
Registered: Dec 2011
Posts: 243

Original Poster
Rep: Reputation: Disabled

Quote:
Originally Posted by michaelk View Post
Try this first, make sure that /dev/sda7 is unmounted then create an uncompressed image with dd. You can mount the image file just like a real partition to see if it was created successfully.
Unmount the image file then dd it back to /dev/sda7.
I have a question about this. In an earlier reply Computersavvy states that "Lastly, you should NEVER use dd to copy from an active (mounted) partition, and NEVER use dd to write to an active (mounted) partition. Doing so is certain to cause file system corruption either in the image or in the destination or both."

I understand unmounting the source, in this case /dev/sda7. But how do I create an image file on a target drive that is not mounted? You say:

Using the following command I create an uncompressed image:

dd if=/dev/sda7 of=sda7.img

I'm assuming that you execute this command from /home/userid, which has to be mounted.

I feel like this is a stupid question. Sorry if it is.
 
Old 01-15-2022, 03:49 PM   #17
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,822

Rep: Reputation: 5960Reputation: 5960Reputation: 5960Reputation: 5960Reputation: 5960Reputation: 5960Reputation: 5960Reputation: 5960Reputation: 5960Reputation: 5960Reputation: 5960
Saving to an image file is not the same thing as saving to an active (mounted) filesystem.

Using dd to write to an image file i.e of=sda7.img is akin to copying data to a file. Nothing out of the ordinary. You just need sudo permissions to access the device i.e /dev/sda7

Writing back to the partition /dev/sda7 i.e of=/dev/sda7 also requires sudo permissions but your writing to the device i.e partition but not the filesystem. Your actually copying the entire filesystem so if it is mounted at the same time you would be overwriting physical data but the operating system stores information in cache and if it changes unknowingly could corrupt the data being written.
 
Old 01-15-2022, 10:16 PM   #18
Tem2
Member
 
Registered: Dec 2011
Posts: 243

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
Saving to an image file is not the same thing as saving to an active (mounted) filesystem.

Using dd to write to an image file i.e of=sda7.img is akin to copying data to a file. Nothing out of the ordinary. You just need sudo permissions to access the device i.e /dev/sda7

Writing back to the partition /dev/sda7 i.e of=/dev/sda7 also requires sudo permissions but your writing to the device i.e partition but not the filesystem. Your actually copying the entire filesystem so if it is mounted at the same time you would be overwriting physical data but the operating system stores information in cache and if it changes unknowingly could corrupt the data being written.
That explains it. Thanks.
 
  


Reply



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
[SOLVED] [SOLVED] bash script: can echo command, command works if I type, but command doesn't work in script ... why? hopeless_n00b Linux - Newbie 10 07-12-2018 05:57 AM
How to restore deleted files from a FAT32 partition? duplex Linux - Software 12 04-08-2013 09:32 AM
How to restore deleted Fedora OS partition running FOG imaging application CTOP Linux - Newbie 8 08-21-2009 11:40 AM
How to restore files using the restore command ? SKYNAT Linux - Newbie 2 12-28-2007 10:26 PM
deleted linux partition adn the boot loader was deleted also,now i have only gnu grub boris199 Linux - Laptop and Netbook 2 01-29-2005 04:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:54 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
Open Source Consulting | Domain Registration