# Mirroring a 750g HD to a 1 TB drive?



## beesatmsu (Apr 8, 2010)

I have successfully used gmirror to duplicate one 750G to another one 750G (identical). i made the mistake of buying 2 750 and 2 1TB. what parameters do I need to replicate the files on 750G to 1TB? if I do not define anything, do I get everything but lose 250 gig of space? that is ok if it works. 

last time I did not need to do anything on the "slave", no newfs or partition. simply did 
"gmirror insert gm0 ad6" after loading gmirror into the loader.conf and also change the fstab.

how does Frebsd name the sata? I never had ad0, a new drive always is ad6, 8, or 4. even if I plug into the 1st sata port. 

what I wanted to do is remove one 750 and rebuild the mirror using the 1tb as a slave. so it saves me the pain of going through all the software installation...(especially kde4 does not want to work with php5).  

thanks.


----------



## SirDice (Apr 8, 2010)

You don't "lose" 250GB of space. It's just not used for the mirror. You can still slice/partition the remaining space.



> how does Frebsd name the sata? I never had ad0, a new drive always is ad6, 8, or 4. even if I plug into the 1st sata port.


Normally it's ad0 to ad3 for the 4 IDE (PATA) ports, ad4 and higher is SATA.


----------



## beesatmsu (Apr 8, 2010)

Thanks. do I need to partition the 1TB first (no instructions how to mirror each partitions separately, only whole drives), or just stick it in like last time? not sure if that would work because it might have different geometries...I am not sure how gmirror work (sector by sector? or file by file).


----------



## SirDice (Apr 8, 2010)

Stick it in, create the mirror as you normally would. Once it's done use gpart or fdisk to slice the rest of that single disk.


----------



## beesatmsu (Apr 8, 2010)

ok, thanks. will try it if this install on the 1TB does not work with php and kde4 together. I have 2 750gb with both working together... wasted a lot of time to do that....maybe it would be easier to mirror it (if it does not screw things up!).

last time I did a dump/restore, the / dir ran out of space with the new disk... did not understand why. and the old disk had X11 broken...


----------



## SirDice (Apr 8, 2010)

Perhaps a hint for next time, if you build things using the ports tree, use `# make package-recursive` (both portmaster and portupgrade also have options to build packages). Make sure /usr/ports/packages exists or point *PKGDIR* to a place with some room. This will create packages after things are build and installed. You can also create packages now using the pkg_create(1) command. 

I always build all my ports and package them up in a jail on my server. The resulting package dir is NFS exported. This makes it really easy to upgrade all my other machines. I can also have things break during compiling without it effecting my current installations. I do this from time to time and always keep a backup of the previous package dir. Makes life a whole lot easier :e


----------



## beesatmsu (Apr 8, 2010)

thanks.
I finally succeeded in getting php to work with kde4...using the dvd always breaks one or the other...used ports and took 24 hrs (lots of prompts waiting for input, so real time was shorter...last time it took one week using a Pentium 4). 
so I am mirroring the 1TB to 1TB now. will buy another 1TB, to make if off site...disk to disk is easy...took me 5 min. now 24% done after 50 min.


----------



## beesatmsu (Apr 8, 2010)

SirDice,
I am not familiar with pkg_create or make package-recursive...now can I do anything post effect? I installed php5, php5-extensions, then kde4 and xorg, all through ports...now how do I package them together? it might save a lot of time next time... thanks. does the handbook deal with this? if so, I can read there.


----------



## SirDice (Apr 8, 2010)

Instead of a `# make install` you would use `# make package` in a port's directory. This will do an install and create a package in one go. Using `# make package-recursive` will do the same but also package all depencies that are build and installed.

I haven't use pkg_create but I think you can do a `# pkg_create -b <packagename>` post effect 
Not sure if it'll also create packages for all it's dependencies though, looks like it doesn't.
It shouldn't be too hard to create a oneliner that goes through a list created by pkg_info and do a pkg_create on each one.


----------



## SirDice (Apr 9, 2010)

beesatmsu said:
			
		

> used ports and took 24 hrs (lots of prompts waiting for input, so real time was shorter...last time it took one week using a Pentium 4).


Almost forgot this one :e
`# make config-recursive`

You may need to run it a couple of times if you turn on options. Or use ports-mgmt/portmaster, it takes care of all the options before starting the build process.


----------



## beesatmsu (Apr 9, 2010)

ok, since I have 2 raid-1 working. i guess today I can try to mirror the 750g to 1tb to see if it works... will report in 4 hrs.


----------



## beesatmsu (Apr 9, 2010)

changed mind...will try to get another 1tb instead...no more time to mess with hardware..


----------



## beesatmsu (Apr 13, 2010)

put one 1TB today to the computer and started mirror. 1st time it tried to do the reverse (mirror from 750 to 1TB) and no error! strange. it is safer to do "gmirror forget gm0" before rebooting...otherwise I do not know which HD is being booted from. 

no error for this one: (from ad8 to ad6) -- thought the smaller drive was put into a higher port...but still named ad6...strange. 


```
> gmirror list                                                     
Geom name: gm0                                                     
State: COMPLETE                                                    
Components: 2                                                      
Balance: round-robin                                               
Slice: 4096
Flags: NONE
GenID: 0
SyncID: 2
ID: 3490861608
Providers:
1. Name: mirror/gm0
   Mediasize: 750156373504 (699G)
   Sectorsize: 512
   Mode: r5w5e14
Consumers:
1. Name: ad8
   Mediasize: 750156374016 (699G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Priority: 0
   Flags: NONE
   GenID: 0
   SyncID: 2
   ID: 1152935286
2. Name: ad6
   Mediasize: 1000204886016 (932G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Priority: 0
   Flags: NONE
   GenID: 0
   SyncID: 2
   ID: 4282770242
```


----------



## DutchDaemon (Apr 13, 2010)

@beesatmsu - please format your posts for readability.


----------

