Advise before modify the partitions

Hello
I've got on my laptop freeBSD and Linux SID
I'd like to modify the configuration of my partitioning of this disk

6243


I'd like to destroy adaS01 adaS02 adaS03 and the liberated space create
a new partiton for freeBSD

I don't want to modify or loose ada0s4 : there is my freeBSD system on
it and it works very good.

I'm from linux and I am not used to freebsd partitioning tools

I was thinking to use the tool sade to delete this 3 parts and to
create a new part
I would have in the end only 2 parts
  • the new part
  • the previous adaS04

After that, could I boot the system or should I reinstall the grub?

thanks for your advices
 
It should be as simple as deleting the other 3 and creating a new one and marking that as a freebsd-ufs. newfs /dev/ada0s1;mount /dev/ada0s1 /mnt and you have new space.

Back up the partition table 1st.
Plug in a empty memory stick. Use dmesg will tell you the name of the new USB disk.
and use dd if=/dev/ada0 of=/dev/WHATEVER_USB_IS count=100 which copies the 1st 100 sectors from the hard drive to the USB stick (wiping out the usb stick).

Then delete s1,s2,s3. Create a new s1. This should give you s1 and s4 and no s2 or s3. If that is the case, you can save the partition table and reboot to verify.

If things go wrong... Have a bootable USB or ISO nearby. The mini-usb image will work fine and boot to that.
Your existing /etc/fstab may be telling the system to mount disks as slice 4 a.
If you think partion names were changed, you can use fsck to verify it. fsck_ufs /dev/ada0s1a
If it did get moved, then update the details in /etc/fstab by mounting it mount /dev/ada0s1a /mnt; edit /mnt/etc/fstab to fix the name. mount -o rw / might help if you can boot the old disk but things are read only.
To restore the backup from above, check dmesg to find out the disk name (it might have changed), and use dd if=/dev/ITS_NAME of=/dev/ada0 count=1 count=1 is useful for MBR disks, the 100 is likely to get other metadata they system might have put at the start of the disk. If it had a newer parition style, you can back it up with gdisk's backup feature.
 
I don't want to modify or loose ada0s4 : there is my freeBSD system on
it and it works very good.

I'm from linux and I am not used to freebsd partitioning tools

I was thinking to use the tool sade to delete this 3 parts and to
create a new part
I would have in the end only 2 parts
  • the new part
  • the previous adaS04
After that, could I boot the system or should I reinstall the grub?

thanks for your advices

Can you show what you have in {adas04}/etc/fstab?

That may need to change if it shows that '/' is being from the fourth partition.

A useful page, which I often refer to when partitioning disks is http://www.wonkity.com/~wblock/docs/html/disksetup.html
although I don't fully understand what it says

To be able to boot the system you will need to run gpart bootcode -b /boot/mbr ada0.

I could be mistaken about that so check. I've started using GPT rather than MBR, so mix the instructions up sometimes.

Also you may want to add a swap partition in the remaining space.
 
Code:
cat /etc/fstab
# Device    Mountpoint    FStype    Options    Dump    Pass#
/dev/ada0s4a    /        ufs    rw,noatime    1    1
#
fdesc    /dev/fd        fdescfs        rw    0    0
proc    /proc        procfs        rw    0    0

Not a problem for me to mount the new created partition (so I hope ;), I'll use it only for virtual box.

I think I don't need a swap, I've got 8Go of RAM and don't use the resume
 
I think thogard's solution is the easiest one in your case. It hase only one disadvantage - the free space is in a particular path and it's not easy to change it.

I know this is not applicable in your case, but if you had used ZFS as a file system instead of UFS, the change would be really easy and you would not have the disadvantage of mounting the new partition to a specific path.
With ZFS you could simply format the partition and add it to your ZFS pool, so the pool becomes bigger and it simply increases the capacity without constraints.

If you have more time, you could boot from a rescue medium and make a tar from your FreeBSD root (make sure to include all permissions and ownerships). Then you can repartition the drive and extract the tar, adjusting your fstab and other configuration if necessary.
This option however takes much more time and there's always the risk to make a mistake and thrash your data.
 
Back
Top