This mailbox accepts e-mails only from selected mailing-lists!
Everything else is considered to be spam and therefore deleted.
07-22-2012, 05:45 PM
Alex Schuster
How can I rewrite all empty sectors with zeros?
Jarry writes:
> I want to backup my whole hard-drive (8 partitions) with:
> # dd if=/dev/sda | gzip > /path/image.gz
>
> In order to achieve good compression level I'd like to wipe
> out all empty space with zeros. How can I do that?
You can create files containing only zeros on all partitions until
they are full. Like this:
for i in 5 6 7 8 9 10 11 12
do
mount /dev/sda$i /mnt
dd if=/dev/zero of=/mnt/zero
rm /mnt/zero
umount /mnt
done
Wonko
07-22-2012, 06:09 PM
Mick
How can I rewrite all empty sectors with zeros?
On Sunday 22 Jul 2012 18:45:50 Alex Schuster wrote:
> Jarry writes:
> > I want to backup my whole hard-drive (8 partitions) with:
> > # dd if=/dev/sda | gzip > /path/image.gz
> >
> > In order to achieve good compression level I'd like to wipe
> > out all empty space with zeros. How can I do that?
>
> You can create files containing only zeros on all partitions until
> they are full. Like this:
>
> for i in 5 6 7 8 9 10 11 12
> do
> mount /dev/sda$i /mnt
> dd if=/dev/zero of=/mnt/zero
> rm /mnt/zero
> umount /mnt
> done
>
> Wonko
Only to add that using bs=4096 or bs=2048 would help this take less than a
week waiting for it to finish. :-)
--
Regards,
Mick
07-23-2012, 09:28 AM
Neil Bothwick
How can I rewrite all empty sectors with zeros?
On Sun, 22 Jul 2012 19:18:44 +0200, Jarry wrote:
> I want to backup my whole hard-drive (8 partitions) with:
> # dd if=/dev/sda | gzip > /path/image.gz
>
> In order to achieve good compression level I'd like to wipe
> out all empty space with zeros. How can I do that?
It may be worth your while looking at partimage (which can also image
whole drives). It only copies used sectors so avoids the problem of
storing obsolete data. I believe Clonezilla uses partimage, and you'd
have to use a live CD to image a system drive like this anyway.
--
Neil Bothwick
War does not determine who is right -- only who is left.
07-23-2012, 02:29 PM
Nikos Chantziaras
How can I rewrite all empty sectors with zeros?
On 22/07/12 20:18, Jarry wrote:
Hi,
I want to backup my whole hard-drive (8 partitions) with:
# dd if=/dev/sda | gzip > /path/image.gz
In order to achieve good compression level I'd like to wipe
out all empty space with zeros. How can I do that?
That's the wrong way to do it. You should use a tool that only copies
the data, and then also backup the partition table.
Or use partimage/clonezilla like Neil mentioned which does all that
automatically.
07-23-2012, 03:31 PM
Simon
How can I rewrite all empty sectors with zeros?
On Mon, Jul 23, 2012 at 10:29 AM, Nikos Chantziaras <realnc@gmail.com> wrote:
On 22/07/12 20:18, Jarry wrote:
Hi,
I want to backup my whole hard-drive (8 partitions) with:
# dd if=/dev/sda | gzip > /path/image.gz
In order to achieve good compression level I'd like to wipe
out all empty space with zeros. How can I do that?
That's the wrong way to do it. *You should use a tool that only copies the data, and then also backup the partition table.
Or use partimage/clonezilla like Neil mentioned which does all that automatically.
For my part, I found compressing all files using squashfs to be most useful, specially for backups as restoring single files vs all files is just as simple.
Also, using the squashfs archive as read-only base of a unioned mount (aufs, unionfs) is also a very useful trick.
As my systems are all setup the same, I never backup the partition table and recreate it each time (easy, and I often change the partition layout anyway).
Simon
07-23-2012, 04:24 PM
Jarry
How can I rewrite all empty sectors with zeros?
On 23-Jul-12 16:29, Nikos Chantziaras wrote:
On 22/07/12 20:18, Jarry wrote:
Hi,
I want to backup my whole hard-drive (8 partitions) with:
# dd if=/dev/sda | gzip > /path/image.gz
In order to achieve good compression level I'd like to wipe
out all empty space with zeros. How can I do that?
That's the wrong way to do it. You should use a tool that only copies
the data, and then also backup the partition table.
Or use partimage/clonezilla like Neil mentioned which does all that
automatically.
I know those tools. Unfortunatelly, they do not support
"smart copying" (only used sectors) if software raid is used.
So I'm back on the beginning: I can clone only the whole
drive (all sectors). No matter if I use dd, clonezila or
partimage...
Jarry
--
__________________________________________________ _____________
This mailbox accepts e-mails only from selected mailing-lists!
Everything else is considered to be spam and therefore deleted.
07-23-2012, 08:01 PM
Nikos Chantziaras
How can I rewrite all empty sectors with zeros?
On 23/07/12 19:24, Jarry wrote:
On 23-Jul-12 16:29, Nikos Chantziaras wrote:
On 22/07/12 20:18, Jarry wrote:
Hi,
I want to backup my whole hard-drive (8 partitions) with:
# dd if=/dev/sda | gzip > /path/image.gz
In order to achieve good compression level I'd like to wipe
out all empty space with zeros. How can I do that?
That's the wrong way to do it. You should use a tool that only copies
the data, and then also backup the partition table.
Or use partimage/clonezilla like Neil mentioned which does all that
automatically.
I know those tools. Unfortunatelly, they do not support
"smart copying" (only used sectors) if software raid is used.
So I'm back on the beginning: I can clone only the whole
drive (all sectors). No matter if I use dd, clonezila or
partimage...
There's good ol' tar too :-) I usually use that one, or rsync if I need
to clone rather than back-up and compress. Those two have never let me
down yet.