LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-28-2024, 03:14 PM   #1
Donny Bahama
Member
 
Registered: Aug 2009
Location: Margaritaville (a state of mind west of Las Vegas), NV
Distribution: Linux Mint
Posts: 61

Rep: Reputation: 1
Restore disk img without overwriting entire disk?


I'm upgrading a Windows system drive. I've created a disk image (using Disks) of the old 256GB drive and I want to write it to the new 1TB drive. But I'd like to not overwrite a partition at the end of the drive. There's plenty of room at the beginning of the drive. I just need a little advice on how to do the restore without stepping on that partition.
 
Old 02-28-2024, 04:39 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,708

Rep: Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898
I don't use Gnome disks for backups but it looks like it clones/restores the entire drive. If it is a byte for byte image you can try mounting a partition from the image and copy the desired files to a filesystem on the new drive.
 
Old 02-28-2024, 06:55 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,129

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
I'm guessing the OP wants to just slap the image back down - partition table, boot loader and all. Windows being windows, there are licensing issues potentially on the horizon.

That should work, but the big drive will look just like the little drive - including its (total) size. That can be fixed, but I've never tried to since before the invention of gpt. The filesystem at the end of the new drive should survive (is it linux ?), but you'll have to redefine the partition precisely to get it to mount.
Just backup the partition on the new drive, use windows own system backup/restore tool, resize partitions in need, and restore the mystery filesystem. Gotta be safer.
 
Old 02-28-2024, 07:37 PM   #4
Donny Bahama
Member
 
Registered: Aug 2009
Location: Margaritaville (a state of mind west of Las Vegas), NV
Distribution: Linux Mint
Posts: 61

Original Poster
Rep: Reputation: 1
Thanks @syg00 so if I want to restore the partition table, bootloader and all, it's going to nuke my partition and there's no good way around that?
 
Old 02-28-2024, 10:59 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,129

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
It will nuke the old partition table on the new disk. That will make the filesystem in that (ex-)partition unreachable. But intact, so the data will still be there. Simply (!!!!) defining a new partition at the correct sector will bring it magically back to life.

sfdisk is the tool of choice here - read the manpage, then use it to dump both disks before you start meddling. Keep the output safe.
After the restore, use gdisk to fix up the new disk to its real size, then feed the line that defined the original mystery partition back in to sfdisk to redefine the partition correctly - see the examples at the end of the manpage.

Take note of my sigline - both lines.
 
Old 03-04-2024, 05:25 AM   #6
MilesWeb
LQ Newbie
 
Registered: Jan 2024
Posts: 8

Rep: Reputation: 1
Directly restoring a disk image won't avoid overwriting existing partitions on the new drive.

You can use Partition Management Software, & follow mentioned instructions to complete the restore process.
 
Old 03-04-2024, 08:28 PM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,660
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Pondering your present situation ... and given that it is Windows ... my initial guess is that you could carve out a new partition and restore the .img file onto that. Then, use whatever features your present-Windows might offer for "restoring from a previous system." Point it – if you can – to that restored partition, and hope that the programmers in Redmond were thinking as you do.

Otherwise: what if you purchased "a brand-new external drive" at your local office-supply store, restored the image onto that, and presented it to Windows as "the hard-disk from the previous system?" ("It" being "an actual disk drive.")

Pure Guessing ...
 
Old 03-08-2024, 12:05 PM   #8
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by sundialsvcs View Post
Otherwise: what if you purchased "a brand-new external drive" at your local office-supply store, restored the image onto that, and presented it to Windows as "the hard-disk from the previous system?" ("It" being "an actual disk drive.")
I once got into a situation where I was required to call Microsoft for a new authorization key... simply because I added a second drive to a previously working system used by my daughters and spouse. It's insane that that would trigger another call to MS support (and the time off work to deal with that bunch) but there ya go. I would be surprised to find that installing a new disk and moving Windows onto it didn't trigger the same problem.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Overwriting free space or overwriting single files restored by photorec fcrok Linux - Security 22 09-15-2012 12:53 PM
Add new cciss driver module to initrd.img ,stage2.img kunalroy2002 Linux - Software 4 09-25-2007 12:09 AM
Failed to symbolic-link boot/initrd.img-2.6.18-4-486 to initrd.img Scotteh Linux - Software 8 06-01-2007 11:24 PM
[php]Reading url [img] and [/img] hylke Programming 13 08-23-2004 01:58 PM
.img burner or way to boot from a .img American Psycho Linux - Software 4 03-24-2004 06:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:45 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