FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 07-22-2012, 05:36 PM
Jesús J. Guerrero Botella
 
Default How can I rewrite all empty sectors with zeros?

You can just fill a file with zeros and let it grow until de device is full.


dd if=/dev/zero of=/foo.0

El 22/07/2012 19:26, "Jarry" <mr.jarry@gmail.com> escribió:
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?



Jarry

--

__________________________________________________ _____________

This mailbox accepts e-mails only from selected mailing-lists!

Everything else is considered to be spam and therefore deleted.
 
Old 07-22-2012, 05:45 PM
Alex Schuster
 
Default 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
 
Old 07-22-2012, 06:09 PM
Mick
 
Default 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
 
Old 07-23-2012, 09:28 AM
Neil Bothwick
 
Default 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.
 
Old 07-23-2012, 02:29 PM
Nikos Chantziaras
 
Default 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.
 
Old 07-23-2012, 03:31 PM
Simon
 
Default 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
 
Old 07-23-2012, 04:24 PM
Jarry
 
Default 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.
 
Old 07-23-2012, 08:01 PM
Nikos Chantziaras
 
Default 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.
 

Thread Tools




All times are GMT. The time now is 01:11 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org