Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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)
You're using dd to clone a partition to a different type of drive.
Quote:
Originally Posted by Luxion
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.
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 ?.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.