UFS a partition extension scenario

I have the following sutuation in my PC and I would like to extend the size of the FreeBSD partition -partition number 13.
The problem is that the extension cannot be continuous unless I delete the var partition (4GB) and recreate it later after the extension and by taking backup. Swap partition does not pose a problem I think.
What can be done with the var partition?
I am looking for the safest scenario and all suggestions are welcome.
I do not have any important data but I am interested not to break the system and need to build it again.
Would it be a solution with a symbolic link?

gpart show
=> 34 1953525101 ada0 GPT (932G)

598771712 58310648 13 freebsd-ufs (28G)
657082360 16777216 14 freebsd-swap (8.0G)
673859576 8388608 15 freebsd-ufs (4.0G)
682248184 1271276951 - free - (606G)

$ df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/ada0p13 27G 22G 2.9G 88% /
devfs 1.0K 1.0K 0B 100% /dev
/dev/ada0p15 3.9G 2.5G 1.1G 70% /var
$
 
partition 13 isnt contiguous to 15, so why bother?
Either create another swap out of 15+ then re-purpose 14 or
Create a 16, do a tar copy to it of /var, rename /var to /var-old, link /var to your new location and reboot.
Or
Don't use partitions....;)
 
partition 13 isnt contiguous to 15, so why bother?
Either create another swap out of 15 then re-purpose 14 or
Create a 16, do a tar copy to it of /var, rename /var to /var-old, link /var to your new location and reboot.
Or
Don't use partitions....;)
It seems logical both. Need to work the procedure though and what is better.
 
I would boot a installation image, change to LiveCD (as advised in the handbook):
Code:
Warning:

There is risk of data loss when modifying the partition table of a mounted file system. It is best to perform the
following steps on an unmounted file system while running from a live CD-ROM or USB device. However, if
absolutely necessary, a mounted file system can be resized after disabling GEOM safety features:

# sysctl kern.geom.debugflags=16

then:
- backup /var
- gpart delete ada0p14 ada0p15
- gpart resize ada0p13
- gpart add swap (optional - can also be a swap file under /, inside ada0p13)
- gpart add var (optional - can also be inside ada0p13)
- growfs ada0p13
- repopulate /var from backup
- check /etc/fstab
- reboot
 
It seems logical both. Need to work the procedure though and what is better.
It all depends on your preference. There is no benefit to partitioning a disk, imo, other than it complicates things when storage is tight as you're now discovering.
swap partitions are a legacy. You can make a swap file so quickly (and move it/delete it) i don't see the benefit of swap partition(s).

Partitions only make dh output look good.
 
I would boot a installation image, change to LiveCD (as advised in the handbook):
Code:
Warning:

There is risk of data loss when modifying the partition table of a mounted file system. It is best to perform the
following steps on an unmounted file system while running from a live CD-ROM or USB device. However, if
absolutely necessary, a mounted file system can be resized after disabling GEOM safety features:

# sysctl kern.geom.debugflags=16

then:
- backup /var
- gpart delete ada0p14 ada0p15
- gpart resize ada0p13
- gpart add swap (optional - can also be a swap file under /, inside ada0p13)
- gpart add var (optional - can also be inside ada0p13)
- growfs ada0p13
- repopulate /var from backup
- check /etc/fstab
- reboot

Many thanks for this clear explanation. All is well understood. What worries me is the backup and then copy of var. How better it should be done? is there any risk for the system to be broken?
 
It all depends on your preference. There is no benefit to partitioning a disk, imo, other than it complicates things when storage is tight as you're now discovering.
swap partitions are a legacy. You can make a swap file so quickly (and move it/delete it) i don't see the benefit of swap partition(s).

Partitions only make dh output look good.

Should I then delete completely the swap partition and expand 13 to 14?
 
If you're hell bent on maintaining this partition scheme, then I suppose so, but that doesn't help you with /var.

You seem to have enough free space on / to copy /var to it. Then follow what @T-Daemon suggested here: #4
 
What worries me is the backup and then copy of var. How better it should be done?
mark_j has given you a good advice:
do a tar copy to it of /var, rename /var to /var-old
You can backup /var from the installation images LiveCD to, e.g.

- a USB stick: tar cvfz /USBstick/var.tgz /var
- if there is no USB stick at hand, create at the end of ada0 a partition, tar(1) there, delete after restoring /var.

Surely there are many other possibilities, feel free to choose a more suitable storage device.

To restore from USB stick (partition): tar xvfz /USBstick/var.tgz -C /root_mnt-point_ada0p13
Don't forget to rename old, partition /var, and to check/modify /etc/fstab.

is there any risk for the system to be broken?
That risk exists always, but as long you take precautions (backups), and execute commands carefully (knowing what they exactly do), then the risk is minimal.
 
There is no benefit to partitioning a disk, imo, other than it complicates things when storage is tight as you're now discovering.
I mostly agree with that. Partitioning disks into many pieces is an old tradition, which has become of limited use today. I still do it, but then I'm both old and old-fashioned. There is one benefit: A misbehaving process that fills up something (typically /home) can not take the system out. But with quota, there is a much better solution for taking care of that problem. But quota doesn't work against the root user, and daemons. With the root file system on ZFS, one can have multiple file systems (with hard quota that root can't exceed) on a single pool, but not everyone has the root file system on ZFS. And the old tradition of separating /, /var, /var/log, /tmp and perhaps even /etc into separate file systems doesn't help much in practice, since if any one of those become full, the system as a whole is likely to stop working (even if it technically doesn't crash), so separation doesn't help. Mostly, it's just traditions.

is there any risk for the system to be broken?
Yes, there is a high risk for you to break the system. Note how I changed the grammar: the system doesn't just spontaneously become broken, the administrator breaks the system. How high the risk is depends on your level of experience, paranoia, and extra care. The one piece of advice I would give: First make the backup of the partition that you are moving to the new place, don't delete the old one yet, and then try running with the new one, and test a reasonable set of system functions (perhaps e-mail and the web server, depending on what your system's purpose in life is). Only after you are convinced that nothing is broken, delete the old partition, and do the next step.

And: If there isn't much valuable information on your system, it might just be easier to save that somewhere else, and wipe and reinstall your system from scratch.
 
I mostly agree with that. Partitioning disks into many pieces is an old tradition, which has become of limited use today. I still do it, but then I'm both old and old-fashioned. There is one benefit: A misbehaving process that fills up something (typically /home) can not take the system out. But with quota, there is a much better solution for taking care of that problem. But quota doesn't work against the root user, and daemons. With the root file system on ZFS, one can have multiple file systems (with hard quota that root can't exceed) on a single pool, but not everyone has the root file system on ZFS. And the old tradition of separating /, /var, /var/log, /tmp and perhaps even /etc into separate file systems doesn't help much in practice, since if any one of those become full, the system as a whole is likely to stop working (even if it technically doesn't crash), so separation doesn't help. Mostly, it's just traditions.

[...]

You're of course correct, but, I think the key here is "old tradition".
Back in the old days [tm], Freebsd (as all Unix-like systems) requires disklabels (or whatever nomenclature was used for various OSs) and partitions to map cylinder boundaries etc all to:
a) increase speed of slow disks and
b) optimise the use of space on the disk.

Since then, disks have become massive and fast and the constraints applied by partitioning are no longer warranted.

If you have a rogue process that fills up a 1TB disk with logging, for example, then you've got bigger problems than partitioning.

My only proviso is that my advice about partitions applies to personal computers. Would I have a multi-user OS with hundreds of users logging in to a system running UFS with everything on 1 disk? Hell no. It would be segmented and expandable, multiple disks mounted for /var, /tmp, /usr, /home etc..

My whole point is that on a home setup, it causes more problems than it solves. Point in case, ippo

Anyway, I'm getting off topic and don't wish to come across as lecturing the OP.
 
Thanks for all the great support here. Well, coming from windows I wanted to set up in an extra laptop something like the old good days. Something like Unix. A system for both personal and professional use. So that is why I partitioned the disk in many slices to try a few OS and see what is best for PRO use. I will mostly use it for programming and data algorithms and some other use including personal use. But, I didn't expect I would find FreeBSD exactly how I wanted an OS to be. I am so impressed with FreeBSD. So, now I decided to wipe out everything and re-install only FreeBSD in a 1T 6 years old laptop. Based on your advice and appreciate the support I am happy to stay with only FreeBSD. It has all probably more than all. Any suggestion for programming packages to install is also welcome.
 
If you're going down that route, do yourself a favour and use ZFS. It will be a bit of a learning curve (though I think you will grasp it quite quickly).
For one thing, it resolves your issue of partitions. It's an option in the install so it's simple and easy.

Programming packages? You mean like IDEs or RADs? FreeBSD has all the languages you would want to use, like C, C++,Perl and all the ones you wouldn't want to use, like Python, Rust, Go, Pascal etc... :eek: (only joking).

There's a great site https://www.freshports.org/ where you can search for packages. You can also use https://www.freebsd.org/ports/devel.html

I'm not sure what your preference is, ports or packages? For novices, you really need to make the choice. Later on as you get more confident you can mix and match using platforms like poudriere, but for now you're best to choose one or the other and stick to it. Just a friendly heads up, apologies if you already know this.
 
If you're going down that route, do yourself a favour and use ZFS. It will be a bit of a learning curve (though I think you will grasp it quite quickly).
For one thing, it resolves your issue of partitions. It's an option in the install so it's simple and easy.

Programming packages? You mean like IDEs or RADs? FreeBSD has all the languages you would want to use, like C, C++,Perl and all the ones you wouldn't want to use, like Python, Rust, Go, Pascal etc... :eek: (only joking).

There's a great site https://www.freshports.org/ where you can search for packages. You can also use https://www.freebsd.org/ports/devel.html

I'm not sure what your preference is, ports or packages? For novices, you really need to make the choice. Later on as you get more confident you can mix and match using platforms like poudriere, but for now you're best to choose one or the other and stick to it. Just a friendly heads up, apologies if you already know this.
\\\

I have included ZFS. I need some kinds of editor or IDE for C/C++. May be emacs, or Vim...or any other better suggestion?
I am still struggling with Windows managers. I am using Openbox but so far so so. I need something easy configurable for programming and some admin tasks. I don't need flashy buttons or full desktops like gnome or Xfce unless there are good arguments there. I need your advice.
I am mixing both installation methods, trying mostly ports I think. What is best here to follow? Install from ports under root or packages under user. That's a key issue for me.
Thanks again for all this support
 
\\\

I have included ZFS. I need some kinds of editor or IDE for C/C++. May be emacs, or Vim...or any other better suggestion?
I am still struggling with Windows managers. I am using Openbox but so far so so. I need something easy configurable for programming and some admin tasks. I don't need flashy buttons or full desktops like gnome or Xfce unless there are good arguments there. I need your advice.
I am mixing both installation methods, trying mostly ports I think. What is best here to follow? Install from ports under root or packages under user. That's a key issue for me.
Thanks again for all this support
Perhaps try geany? I've used it for small projects and it's not a CPU hog like eclipse.

Conventional wisdom will tell you to not mix ports and packages. However, there are several "safer" ways to mix ports and packages.
1. You can maintain a static port and packages collection. For example, the packages from release_0 match the initial ports tree distributed with FreeBSD 12.1R. Upgrade/change neither and you can mix and match.

2. Build ports using poudriere, set up a dummy web server, create a custom package configuration pointing to it and use pkg manager as you always did.


If you're going down this route, you will need to understand the use of /usr/local/etc/pkg/repos/ to create custom package configurations.

My suggestion: until you become au fait with the ports and packages system, you pick one and stick to it or you might find yourself with a broken system, but if you don't mind a broken system, then you can experiment away.
 
Back
Top