# backup & restore a partition using cpio from compressed .gz file



## ccc (Aug 16, 2010)

hi

I've saved a big /usr partition using *cpio* instead of .cpio into compressed .gz file:
	
	



```
# cd / ; find ./usr -depth -print -xdev | cpio -ovfB | gzip -c > /mnt/backup_usr.gz &
```

Normaly I can recover from a .cpio file using:
	
	



```
# cpio â€“ivdmlu < /backup_usr.cpio &
```

My question is, how it works to recover from a compressed .gz file?


----------



## SirDice (Aug 16, 2010)

Something like this perhaps?

```
zcat backup_user.gz | cpio -ivdmlu
```


----------



## Beastie (Aug 16, 2010)

And using *>* is wrong/useless, as I have already mentioned in an older thread.


----------



## ccc (Aug 16, 2010)

Beastie said:
			
		

> And using *>* is wrong/useless, as I have already mentioned in an older thread.



sorry, for a mistake you're right!


----------



## ccc (Aug 16, 2010)

other way:
	
	



```
# cd /;gunzip </mnt/backup_usr.gz | cpio -ivdmlu
```


----------



## gordon@ (Aug 19, 2010)

Using a recent version of FreeBSD, just use tar(1):


```
tar xvpf /mnt/backup_usr.gz -C /
```


----------

