# gmiror  for two slices on the same disk



## rocky (Jun 3, 2009)

Hello all,

I installed FreeBSD on 1 hard disk of the laptop. The disk layout is as below:


```
slice 1, partition b => swap
slice 2, partition a => root   (/)
slice 3, partition d => home   (/home)
slice 4, partition a => backup (/backup)
```

The partion `a` on last slice is used for backup purpose. I often use `rsync` to copy data from /home to /backup (in case something wrong to /home). This task consumes so much time and CPU resource.

I wonder if we can use `gmirror` to mirror the /home to /backup . This is almost a soft raid-1 solution but for two slices on the same disk.

Is this possible? And how about the performance?

Thank you for replies.


----------



## jb_fvwm2 (Jun 3, 2009)

I do not know, but I use /rsnapshot/ as a front-end to
rsync, and run it with a script:
..excerpt:
..........
gnice ...... rsnapshot_1.zsh
sync
gnice ....... rsnapshot_2.zsh
sync...
...........
the gnice may make it less CPU intensive and
the sync may prevent it from panicing the system when
copying to a disk, wiping the target partition table
(happened twice).
/edit/
each time, I had done stuff in the target filesystem
before or during the backup
/end edit/
.......
About your question, I am wondering if you want the backup while
all filesystems are mounted, and/or before boot, and/or...


----------



## SirDice (Jun 3, 2009)

Using gmirror _should_ work but I never tried it. One thing to note though, the partitions will need to be of equal size. Not so sure about performance but I guess you just attach the mirror, let it sync then detach it again. If you don't detach it it won't be much use as a back up because accidentally removing a file will also remove it on the mirror (which is usually the reason to have a backup in the first place).


----------



## vivek (Jun 3, 2009)

RAID is not backup. RAID is done to improve disk I/O performance and fault tolerance. 

A backup must be offsite and recoverable under any condition. Backup on same or 2nd disk on the same system is not backup. Usually, dump/restore is the best tools. You can also use rsnapshots to create backup snapshots.


----------



## phoenix (Jun 3, 2009)

Doing backups to the same disk using gmirror will slow things down tremendously.  For every write to a file, 2 disk writes will be generated, to 2 separate parts of the same disk, requiring the drive heads to thrash around from one slice to the other.  Don't do mirroring to the same disk.

This is also why the rsync is slow ... it reads a chunk of data from one part of the disk, then writes that chunk of data to a different section of the same disk.  It has to break things up into chunks like this, which really slows things down.

Get a separate disk for doing backups.


----------



## rocky (Jun 4, 2009)

Thank you all for the kind helps. 

I will backup my data offsite.

Regards,


----------

