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.
I have a question that maybe is answered in some of the 46 pages, but sincerely i dont read al the posts.
I fill the disk with zeros: dd if=/dev/zeros of=/file.zeros
i remove /file.zeros
i do a dd of my sda disk: sda1: /boot
sda2: LVM
lvm1: /
lvm2: swap
the compressed dd file is 3 gb but the dd itself its 136 gb
Now i want to use the image to create a kvm guest, but i dont want to create a 136 gb file; i.e. only a 15 gb file with the files and some extra space.
(i understand that i need some kind of defrag to move all data to the begining and then maybe i have to resolve some problems related to the geometry of the disk.)
Is this posible?
Regards
Last edited by oso_togari; 08-29-2011 at 06:06 AM.
Reason: explain
Click here to see the post LQ members have rated as the most helpful post in this thread.
I logged into my server via ssh and ran dd in the background. My ssh session terminated when my laptop went to sleep. I logged back in to the server to check status but don't know how to do it
I logged into my server via ssh and ran dd in the background. My ssh session terminated when my laptop went to sleep. I logged back in to the server to check status but don't know how to do it
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Original Poster
Rep:
Compressed Partition Image Files
Quote:
Originally Posted by oso_togari
Hi all
I fill the disk with zeros: dd if=/dev/zeros of=/file.zeros
i remove /file.zeros
i do a dd of my sda disk: sda1: /boot
sda2: LVM
lvm1: /
lvm2: swap
the compressed dd file is 3 gb but the dd itself its 136 gb
Now i want to use the image to create a kvm guest, but i dont want to create a 136 gb file; i.e. only a 15 gb file with the files and some extra space.
(i understand that i need some kind of defrag to move all data to the begining and then maybe i have to resolve some problems related to the geometry of the disk.)
Hi oso,
The dd command duplicates files as a bitstream. In UNIX and Linux, disks and file systems are available as virtual files in the /dev directory.
You didn't list the exact command lines you used, so I don't really know what you did. But if you want to get the files out of a compressed disk image file, you have to uncompress it, mount it.
Then, make an image file to hold just the files, but not the free space.
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Original Poster
Rep:
killall USR1 is not the same as kill USR1
Quote:
Originally Posted by chadr
I logged into my server via ssh and ran dd in the background. My ssh session terminated when my laptop went to sleep. I logged back in to the server to check status but don't know how to do it
Are there any options for me to see the status? Thanks.
I think using killall and specifying a pid might create a problem. I would just use the command line found in the OP. You have to open 2 ssh sessions. In the first one type:
Code:
<CTRL>z
fg
the dd command output should appear, which will be nothing until you type the command
In the place of bin, just put something that differentiates between the dd processes, i.e. every ps aux | grep <command> will contain output of the ps command itself. So you have to tell awk something it can use to grab the correct line.
Then, if you switch back to the first of the 2 ssh sessions, it should have spit out a progress report on the dd process.
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Original Poster
Rep:
Quote:
Originally Posted by deanksalinux
Hi there
Is it possible to use dd to copy on used space while ignoring free space.
I can then extend the partitions if need be.
Thanks
Clonezilla will image one disk to another, copying only used space. But I'm a little confused as to the limitation that the destination partition must at least as large as the source partition. http://clonezilla.org/clonezilla-live.php
@ awesome-machine, using dd is there a way to copy a 2 gb drive (boot sector + 1 partition) so that when it is restored to a 100 gb drive, it can be expanded to read/write the whole drive ?
You haven't given many details of the background behind your question, so this may or may not be an appropriate suggestion. You use the word "restore", & to me this implies that your source (2 GB) will be copied to an intermediate medium, some time may pass, & then the intermediate medium will be copied to your final target (100 GB). Would Clonezilla work for you? (Please note, dd is one of several tools that Clonezilla uses.)
Meanwhile, especially if my inference above is wrong, expect the details of a "pure" dd method to be forthcoming.
You haven't given many details of the background behind your question, so this may or may not be an appropriate suggestion. You use the word "restore", & to me this implies that your source (2 GB) will be copied to an intermediate medium, some time may pass, & then the intermediate medium will be copied to your final target (100 GB). Would Clonezilla work for you? (Please note, dd is one of several tools that Clonezilla uses.)
Meanwhile, especially if my inference above is wrong, expect the details of a "pure" dd method to be forthcoming.
hi, this was for my fc-11 backup but since i got fc-15 now it is kinda' moot.
my premise is to install the os on a 2 gb drive and install all the packages i want (and configure things like compiz-fusion how i like).
so then if i want to install it on another pc (since it is easier to carry around a 2 lbs weight rather than 100 pounds) i can reimage the disk and expand the partitions.
i havent tried clonezilla... i'll look into it if there is a next time.
edit: i'll also mention that i like imaging the whole disk (i.e. dd if=/dev/sda) rather than a partition (/dev/sda1) because its more comprehensive. (i dont like needing to chroot mountpoint; grub-install ...)
but lets say i want to loop mount one of the partitions of the disk image and save changes ?
i think buried in this thread are instructions how to do this but i dont remember where.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.