quinta-feira, 6 de outubro de 2016

Adicionando um novo disco ao seu Freebsd

Originally contributed by David O'Brien.
This section describes how to add a new SATA disk to a machine that currently only has a single drive. First, turn off the computer and install the drive in the computer following the instructions of the computer, controller, and drive manufacturers. Reboot the system and become root.
Inspect /var/run/dmesg.boot to ensure the new disk was found. In this example, the newly added SATA drive will appear as ada1.
For this example, a single large partition will be created on the new disk. The GPT partitioning scheme will be used in preference to the older and less versatile MBR scheme.

Note: 

If the disk to be added is not blank, old partition information can be removed with gpart delete. See gpart(8) for details.
The partition scheme is created, and then a single partition is added. To improve performance on newer disks with larger hardware block sizes, the partition is aligned to one megabyte boundaries:
# gpart create -s GPT ada1
# gpart add -t freebsd-ufs -a 1M ada1
Depending on use, several smaller partitions may be desired. See gpart(8) for options to create partitions smaller than a whole disk.
The disk partition information can be viewed with gpart show:
% gpart show ada1
=>        34  1465146988  ada1  GPT  (699G)
          34        2014        - free -  (1.0M)
        2048  1465143296     1  freebsd-ufs  (699G)
  1465145344        1678        - free -  (839K)
A file system is created in the new partition on the new disk: (Formatando Particao)
# newfs -U /dev/ada1s1a


Lista os nomes das particoes:
# glabel status
Name  Status  Components
ufsid/57c795fe83c74d4c     N/A  ada0s1a
           label/swap0     N/A  ada0s1b
ufsid/57c796039eb27d54     N/A  ada0s1d
ufsid/57c79607788cb9ee     N/A  ada0s1e
   diskid/DISK-QM00007     N/A  ada1
ufsid/57f6f78d5b2901be     N/A  ada1s1a
             


Adicionando  UUID do Disco no FS fstab /etc/fstab

# Device  Mountpoint FStype Options  Dump Pass#
/dev/ufsid/57c795fe83c74d4c  /  ufs rw  1 1
/dev/label/swap0  none  swap sw  0 0
/dev/ufsid/57c796039eb27d54  /usr  ufs rw  2 2
/dev/ufsid/57c79607788cb9ee  /var  ufs rw  2 2



An empty directory is created as a mountpoint, a location for mounting the new disk in the original disk's file system:
# mkdir /newdisk
Finally, an entry is added to /etc/fstab so the new disk will be mounted automatically at startup:
/dev/ada1p1 /newdisk ufs rw 2 2
The new disk can be mounted manually, without restarting the system:
# mount /newdisk

Nenhum comentário: