[PLUG] Copying all partitions of a drive to single partition/directory?

Tyrell Jentink tyrell at jentink.net
Sat Jan 5 13:18:52 UTC 2019


Your original question seemed to imply you wanted to maintain the partition
layout for some reason. If you do, disk images are the correct way to do
it... But, as others have said, you might not actually have meant to ask
for that...

If what you want is the files, not the partitions, you can use 'cp -a,' or
even 'rsync -a'.

IF you want the partitions, that's what a disk image is for. Disk images
are generally read only, but they are mountable.

I have used disk images in a lot of ways...
Related to your use case, I have used disk images to create "Archives" of
machine states; In other words, I can use that image to restore my full
disk back to it's current system state. Or, I can simply mount the "Old"
system into my new file system and copy a file out if I need it. Those will
typically be treated as "Read Only," after all, it's an archive.

I have also used disk images in virtual machines... They are really just
text files, mounted as loop devices and partitioned and formatted like a
block device... You can use them in any way you can use a block device,
including writing to it.

Heck, I have entire services running in disk images that are shared over
iSCSI... I mean, complex scenarios can be constructed with these things.

> The standard tool for taking a disk image is 'dd.' Man page:
> > http://man7.org/linux/man-pages/man1/dd.1.html
>
> That's where I started ;/
>

Then you have what you need...

> Theoretically, you can simply image the entire drive, partitions and all
> > intact exactly as they are presently, although I've never done it that
> > way... I have always imaged partitions directly... But I don't see why
> > either method would be "wrong," as long as you know how to mount the
> output
> > ;)
>
> That "Theoretically" is the kicker.
>

Ugh... I'm sorry for dispensing doubt... I *HAVE* worked with full disk
images in the context of Virtual Machines. I have even started with a plain
text file, mounted it with a loop mount, and partitioned and formatted it.
They work. They work well. When I said "Theoretically," I meant "Make sure
you know how this works before you do it," not "Don't do it."

>
> >
> > As for compressing it...
> > https://serverfault.com/questions/52260/compressing-dd-backup-on-the-fly
> > suggests you can simply pipe the output of 'dd' directly into gzip... But
> > one of the comments says not to use it for the purposes the original
> poster
> > suggested it for, so maybe read their warnings before following their
> > advice.
>
> I hadn't seen that particular article. But a similar one was what
> prompted me to post.
>
> I hoped there was a tool. As I intend to erase the hard drive in each
> machine before doing a fresh Debian install I NEED to have a copy in a
> safe place. I WANT it stored in such a manner that I can retrieve
> individual files/directories.
>

Once you dd the image... You can mount the image. With 'mount -o'  command.
This article appears to cover the ins and outs pretty well, although I just
glanced over it...

http://www.cs.montana.edu/~andrew.hamilton/cs560/VFS/mount.html

Don't know if what I want is actually possible.
> Don't know if there is something basic that I don't know.
> Thank you.
>
>
> >
> > On Fri, Jan 4, 2019, 06:08 Richard Owlett <rowlett at cloud85.net wrote:
> >
> >> I wish to do fresh Debian installs to three machines {including
> >> repartitioning drives of each machine}. Each drive is nominally 250GB. I
> >> have purchased a USB connected 1TB drive to be the target.
> >>
> >> I like the ease of use of Clonezilla-live. But it intrinsically wipes
> >> the target drive completely. Compressing the output would be nice.
> >>
> >> TIA
> >>
>
> _______________________________________________
> PLUG mailing list
> PLUG at pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>



More information about the PLUG mailing list