Freebsd – How to modify partition in FreeBSD 10 with gpart

freebsdpartition

I am using FreeBSD. My HDD has this set of partitions:

root@core:/media # gpart show
=>       63  390721905  ada0  MBR  (186G)
         63       1985        - free -  (993K)
       2048   13365248     1  !39  (6.4G)
   13367296         44        - free -  (22K)
   13367340  174063519     2  freebsd  [active]  (83G)
  187430859      57397        - free -  (28M)
  187488256  203231232     3  ebr  (97G)
  390719488         23        - free -  (12K)
  390719511       2394     4  freebsd  (1.2M)
  390721905         63        - free -  (32K)

=>        0  174063519  ada0s2  BSD  (83G)
          0  174063518       1  freebsd-ufs  (83G)
  174063518          1          - free -  (512B)

=>        0  203231232  ada0s3  EBR  (97G)
          0   14485504       1  linux-swap  (6.9G)
   14485504  188745728  229929  linux-data  (90G)

=>   0  2394  ada0s4  BSD  (1.2M)
     0  2394          - free -  (1.2M)

I want to add swap drive to FreeBSD by modifying linux swap. In fact I do not use linux drive at all, and don't care if it's removed.

I am doing this to modify partition:

root@core:/media # sudo gpart modify -i1 -t freebsd-swap ada0s3
gpart: pre-check failed: Operation canceled

What am I doing wrong? Any input is appreciated.

Best Answer

I am understanding, that you already have one linux-swap partition (ada0s3).

If this is the case, just add the partition to /etc/fstab

If not, I recommend you to use fdisk for MBR partition tables or gdisk for GPT partition tables instead to edit the partition table as you want and then execute: mkswap partition, swapon partition and then add the partition to /etc/fstab.

For example

#add /dev/ada0s3 to /etc/fstab as swap partition
echo "/dev/ada0s3   swap    swap    defaults    0   0" >> /etc/fstab
Related Question