how to? replace a single hard drive with mirrored hard drives in a two bay system

Status
Not open for further replies.

milspec

Cadet
Joined
Sep 7, 2012
Messages
5
Hi all,

How canI replace a single hard drive with two mirrored hard drives in a two-bay system.

A while ago I set up a cheap foxconn two-drive-bay atom system and used a single spare hard drive. (Using ZFS. Yes I know it doesn't make sense to use ZFS with a single drive, but I was very new at the time and the drive was big enough)

I want to replace the single hard drive with two mirrored (RAID1) hard drives

Question:
What's the best way to do this?

Current status:
  • Freenas 8.0.3. I tried upgrading to 8.2 but the upgrade failed.
  • I have backed-up-via rsync-over-the-network the "old drive" to an external NTFS drive
  • I have installed the new hard drives
  • I have an additional external enclosure in which I can put the old hard drive
  • The OS boots up and recognizes the hard drives.
  • THe Freenas GUI, however, is confused as its internal-database is inconsistent with the hard drives on the system

Brute force?
I planned to reinstall freenas onto a new flash drive, create the mirrored volume with the two new drives, and then rsync-via-ssh from the "backup NTFS drive" to freenas. This is slow and requires me to reload my ssh keys etc...

Cleaner Approach?
I wondered if anyone could offer a cleaner approach:
e.g. mounting the "old drive" (zfs) via USB, updating the freenas internal sqllite db to "remap" the original volume to the "usb drive" and using plain old copying ('cp -r')


thanks
 

William Grzybowski

Wizard
iXsystems
Joined
May 27, 2011
Messages
1,754
First step is upgrade to 8.2, 8.0.3 has too many bugs. Save the config, install 8.2 fresh and reload the config.

You can turn a single disk zfs pool into a mirror using the following command:

#zpool attach PoolName attach currentdiskp2 newdisk

Where currentdisk is probably ada0p2, and newdisk is ada1.
 

milspec

Cadet
Joined
Sep 7, 2012
Messages
5

You can turn a single disk zfs pool into a mirror using the following command:

#zpool attach PoolName attach currentdiskp2 newdisk



Thanks. That worked, except for "currentdiskp2", I had to use the "gptid/3c5372b3-143.." identfier

i.e.
# zpool attach gptid/3c5372b3-1423-11e2-abb0-d0278862f3e2 ada0


my "new disk" was ada0"
 

paleoN

Wizard
Joined
Apr 22, 2012
Messages
1,403
# zpool attach gptid/3c5372b3-1423-11e2-abb0-d0278862f3e2 ada0
This uses the whole disk vs the second partition on the new disk. IMHO, it's a bit cleaner to mirror the partition setup on the existing disk as the GUI seems to make some assumptions & whole disks don't appear to be one of them.

If you are so inclined the commands to detach, partition and reattach using the partition. Keep in mind the pool is not redundant until the resilver finishes after the last command.
Code:
zpool detach PoolName ada0

gpart create -s gpt ada0

gpart add -i 1 -t freebsd-swap -s 2G ada0

gpart add -i 2 -t freebsd-zfs ada0

zpool attach PoolName gptid/3c5372b3-1423-11e2-abb0-d0278862f3e2 ada0p2
 

milspec

Cadet
Joined
Sep 7, 2012
Messages
5
Thanks this is helpfull.

>gpart add -i 1 -t freebsd-swap -s 2G ada0

How did you decide on the 2G swap size? Is that standard?

also does the GUI offer the ability to solve the original problem : add one disk as a mirror of another (i.e. did I miss it?)



finally: why does one show up with a 'generated id', the other as ada0p2?

zpool status:


NAME STATE READ WRITE CKSUM
storage ONLINE 0 0
0
mirror ONLINE 0 0
0
gptid/3c5372b3-1423-11e2-abb0-d0278862f3e2 ONLINE 0 0
0
ada0p2 ONLINE 0 0




thanks again
 

paleoN

Wizard
Joined
Apr 22, 2012
Messages
1,403
Thanks this is helpfull.
Glad it helped. William had just posted those commands in a different thread.

How did you decide on the 2G swap size? Is that standard?
2G swap is the default value for sometime in FreeNAS 8.

also does the GUI offer the ability to solve the original problem : add one disk as a mirror of another (i.e. did I miss it?)
Not currently. Most people would start off with at least two drives anyway.

finally: why does one show up with a 'generated id', the other as ada0p2?
Have you rebooted yet? I believe they will both use the gptid after a reboot. If not then an export/import likely "fix" it.
 
Status
Not open for further replies.
Top