LinuxQuestions.org
Visit Jeremy's Blog.
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 10-24-2016, 03:40 AM   #1
Luxion
LQ Newbie
 
Registered: Aug 2016
Posts: 7

Rep: Reputation: 1
Problem using dd to image a server into a VM


For reasons too long to easily explain, I would like to use dd to image the drive of a physical server and write that drive into a VMware virtual disk. When I use "dd if=/dev/sda1 of=/mnt/networkshare/someimage.img" to image the /dev/sda1 partition into a file on a network share, I'm unable to use losetup to mount it as an image, it doesn't see a filesystem. Shouldn't this be possible? I tried using "dd if=/mnt/networkshare/someimage.img of=/dev/sda1" on a fresh VM to write it back out into the new location, and it can't mount that filesystem. Not sure what I'm doing wrong, dd should be able to image drives this way. Ideally I'd like to just replace the disk and boot into this environment, but even if that doesn't work, I should still be able to mount it as a disk in an existing VM and copy the data over.

filesystem is ext3. DD was run on a mounted filesystem, and I know this is a no-no, but the system is under very little load most of the time and writes are very infrequent. I'll accept some level of file corruption, but I should be able to see the filesystem.

(TL; DR version of why I have to do it this way: VMware converter fails to convert this machine, software is an old version of Debian 5 (Lenny) and the package management is broken. If I can virtualize this, I can start to use snapshots and try to repair the damage and incorporate into our backup system)
 
Old 10-24-2016, 04:47 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,938

Rep: Reputation: 1210Reputation: 1210Reputation: 1210Reputation: 1210Reputation: 1210Reputation: 1210Reputation: 1210Reputation: 1210Reputation: 1210
Quote:
Originally Posted by Luxion View Post
Not sure what I'm doing wrong,
You're using dd to clone a partition to a different type of drive.
Quote:
Originally Posted by Luxion View Post
dd should be able to image drives this way.
Why should it? It copies and converts bytes, it has no knowledge of what a filesystem is or how to convert things like partition information, sector offset tables, etc.
In the past I've had some success booting clonezilla to image a drive then creating an empty VM with a suitable empty drive and then using clonezilla to restore. However, if your existng machine has any non-standard drive types, controllers, etc. then you may find that simply restoring an image to a host won't work either.
 
Old 10-24-2016, 05:03 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,127

Rep: Reputation: 2922Reputation: 2922Reputation: 2922Reputation: 2922Reputation: 2922Reputation: 2922Reputation: 2922Reputation: 2922Reputation: 2922Reputation: 2922Reputation: 2922
Quote:
Originally Posted by Luxion View Post
filesystem is ext3. DD was run on a mounted filesystem, and I know this is a no-no, but the system is under very little load most of the time and writes are very infrequent. I'll accept some level of file corruption, but I should be able to see the filesystem.
That might be true if all the meta-data was disk resident. What about all that cache/slab that Linux makes use of. Snaps get around this by use of fsfreeze and CoW.
What does "file" make of that img file ?.
 
  


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
[SOLVED] Slackware 14.1 32bit system tarball/stage3 image/chroot image/bootstrap image vinipsmaker Slackware 20 05-14-2014 01:41 AM
problem in image,pdf,.iso file transfer from java client to c++ server (2 machine) neethu Linux - Networking 1 01-12-2012 12:27 PM
i have server which has Linux version centos i want to create the image of the server dhirendrs Linux - Newbie 6 07-22-2010 08:20 PM
clonezilla clone disk to image, when restore from image to destination hdd problem. hocheetiong Linux - Newbie 3 05-06-2008 07:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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