On 04/09/2019 16.12, ToddAndMargo via users wrote:
On 9/3/19 10:59 PM, John Harris wrote:
> On Tuesday, September 3, 2019 10:03:21 PM MST ToddAndMargo via users wrote:
>> Hi All,
>>
>> I have a flash drive with about four partitions on is.
>> Lets call it /dev/sdc.
>>
>> Can I tar sdc or am I stuck with tarring the partitions?
>>
>> Any drawback to this?
>
> If you were to `tar` it, you'd be making an archive with a single file named
> 'sdc'. I suggest you do this:
>
> dd if=/dev/sdc of=/path/to/file
> gzip /path/to/file
>
> (Feel free to use some other software for compression)
>
This looks like what I want. Thank you!
Is there a way to pipe the dd into the gzip file?
As for your question (but see later), yes:
dd if=/dev/sdc | gzip >file.gz
but
- gzip may not be the most suitable compression
- to improve the compression, mount each partition and create a large file of zeroes
sudo mount /dev/sdXn /path/to/mountPoint
dd if=/dev/zero of=/path/to/mountPoint/zero
rm /path/to/mountPoint/zero
sudo umount /path/to/mountPoint
Now you can do the dd and expect a smaller gz file.
However, the most important question that needs answering is this:
What is the purpose of this exercise?
- is this for backup - not expecting to read it again.
dd is OK
but clonezilla will do a better job (no need to do the zero thing)
- is this to allow transferring the data to another USB disk
clonezilla is your friend again
- will you need regular access to individual files on these partitions?
mount each partition and copy (rsync) the content to where you want it
HTH
--
Eyal at Home (fedora(a)eyal.emu.id.au)