GPT, Adding New Harddisk in FreeBSD
Recently I bought a new harddisk to replace my corrupted one in my FreeBSD home server. I’m running a FreeBSd 8.4-RELEASE-p16 OS and bought a new 3TB capacity harddisk for the replacement. This will required a GPT formating as traditional BSD disklabel/MBR formating (From sysinstall) have the 2TB capacity limitation and would not recognized the space more than 2TB. If you still need to use old MBR formating for some reasons, you will have to create multiple partition inside the 3TB capacity haddisk.
My new harddisk (The 3TB drive) is a replacement of my old storage harddisk, so I will use the entire 3TB space in a single mount point/disk label.
So let’s the fun begins.
If you don’t have gpart installed, please install it first from the ports tree.
cd /usr/ports/sysutils/gpart && make install clean
else proceed to the fun…..
1. Clear the current partition on the disk if any, this guide will be using disk name ad10. You can check you harddisk name from dmesg output or using the “atacontrol list” command.
gpart destroy -F ad10
2. Create a new partition in ad10 disk.
gpart create -s gpt ad10
3. Add a freebsd UFS disk label, this will create a new label (wdblue1tb) inside the ad10 disk partition and a new dev file in /dev/gpt/wdblue1tb to be use for OS mounting. You can use any label name as you like.
gpart add -t freebsd-ufs -l wdblue1tb ad10
The above will used all of the disk space into wdblue1tb.
If you like to create multiple label in a single partition, apply the “-s ” option.
gpart add -t freebsd-ufs -l wdblue1tb -s 50G ad10 -> To create a 50GB disk label in ad10 disk.
gpart add -t freebsd-ufs -l wdblue1tb -s 100M ad10 -> To create a 100MB disk label in ad10 disk.
If you like to add a swap disk to the new harddisk, just switch the “-t freebsd-ufs” to “-t freebsd-swap” and specify the space using the “-s” option.
4. Check and verify if you correctly create the partition and the disk label.
gpart show -l ad10
=> 34 1953525101 ad10 GPT (931G)
34 1953525101 1 wdblue1tb (931G)
5. Once you confirmed, it’s time to format the new disk (label).
newfs -U /dev/gpt/wdblue1tb
6. Create a new folder to be used for the mount point. In this sample I will use /maui2
6. Edit your /etc/fstab file to include your new harddisk during the system boot up.
Put something like this in a new line :
/dev/gpt/wdavgp1tb /maui2 ufs rw 0 1
Save and exit.
7. Manually test mounting the new disk (lable) to make sure it can be mount properly.
mount /dev/gpt/wdblue1tb /maui2
Run the “df -h” command and make sure /maui2 are listed in the mount point list, similar as below:
/dev/gpt/wdblue1tb 902G 4.0k 830G 0% /maui2
8. It’s done. You can also reboot the server to see if the server mount correctly as specify in /etc/fstab file. Anyway it should work if no spelling errors in the file.
Thanks for reading.
Latest posts by MaUi (see all)
- Bad disk detached and I wonder why, why, why, why, why. - September 21, 2016
- How I play Pokemon Go (0.37+) on rooted Android phone - September 15, 2016
- DMARC || SPF Check script with full recursive report - July 28, 2016