DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 3rd December 2022
lattimro lattimro is offline
Port Guard
 
Join Date: Jun 2021
Posts: 13
Default Reclaim unused space

Hi Folks,

I am following https://daemonforums.org/showthread.php?t=9472,
Very nice "How to ...". I tried to reclaim the unused space on "c". I did something wrong, I started with b 64 but instead * (to the end) I enter a smaller number for size (I wanted to test how would create a smaller partition). I actually don't know what size 33554368 means, I assumed sectors.
I do not know how to enter size in m or g.
However, now the unused size is 16,384.0Mb and the free only 5.2Mb. Can I start over again?

What is a default starting sector [64]?
Attached Images
File Type: png Screenshot_2022-12-02_22-05-43.png (130.7 KB, 8 views)
File Type: png Screenshot_2022-12-02_22-26-47.png (78.9 KB, 7 views)

Last edited by lattimro; 3rd December 2022 at 04:56 PM.
Reply With Quote
  #2   (View Single Post)  
Old 3rd December 2022
bsd-keith bsd-keith is offline
Real Name: Keith
Open Source Software user
 
Join Date: Jun 2014
Location: Surrey/Hants Border, England
Posts: 275
Default

To give a size in MB or GB, use +1M, +1G (+5M, +9G) etc.

(At least, that works on OpenBSD, should be the same for FreeBSD).

Yes, re install with the sizes you want.
__________________
Linux since 1999, & also a BSD user.
Reply With Quote
  #3   (View Single Post)  
Old 3rd December 2022
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,854
Default

Your virtualbox drive contains 33554368 512-byte sectors. That's 15.999 GB (16383.968) MB, if I did the math right. Automatic allocation of partitions is as follows, from the disklabel(8) man page:
Code:
     Disks >= 10 Gigabytes
           /                5% of disk.  150M – 1G
           swap            10% of disk.   80M – 2x max physical memory
           /tmp             8% of disk.  120M – 4G
           /var            13% of disk.   80M – 4G + 2x size of crash dump
           /usr            10% of disk. 1500M – 30G
           /usr/X11R6       3% of disk.  384M – 1G
           /usr/local      15% of disk.    1G – 20G
           /usr/src         2% of disk. 1500M – 3G
           /usr/obj         4% of disk.    5G – 6G
           /home           30% of disk.    1G – 300G
Reply With Quote
  #4   (View Single Post)  
Old 3rd December 2022
lattimro lattimro is offline
Port Guard
 
Join Date: Jun 2021
Posts: 13
Default

Quote:
Originally Posted by jggimi View Post
Your virtualbox drive contains 33554368 512-byte sectors. That's 15.999 GB (16383.968) MB, if I did the math right. Automatic allocation of partitions is as follows, from the disklabel(8) man page:
Code:
     Disks >= 10 Gigabytes
           /                5% of disk.  150M – 1G
           swap            10% of disk.   80M – 2x max physical memory
           /tmp             8% of disk.  120M – 4G
           /var            13% of disk.   80M – 4G + 2x size of crash dump
           /usr            10% of disk. 1500M – 30G
           /usr/X11R6       3% of disk.  384M – 1G
           /usr/local      15% of disk.    1G – 20G
           /usr/src         2% of disk. 1500M – 3G
           /usr/obj         4% of disk.    5G – 6G
           /home           30% of disk.    1G – 300G
yes, that's correct, the allocated OpenBSD: 16383.97Mb / 1024 = 15.99996948242188 Gb.
and: 16378.76953125.
free: 16383.97-16378.77=5.2

Can I do Automatic allocation (disklabel -A) now on the installed filesystem? Or you are referring to a fresh installation?

Quote:
If an existing partition is followed by unallocated free space, you may increase its size using the growfs(8) utility. Make sure the partition is not currently mounted. Edit your partition table interactively with disklabel -E sd0 and modify the size of the partition using the m command. Adjust the filesystem to use the entire partition with growfs(8):
How to determine "If an existing partition is followed by unallocated free space" ?

Last edited by lattimro; 3rd December 2022 at 08:19 PM.
Reply With Quote
  #5   (View Single Post)  
Old 3rd December 2022
lattimro lattimro is offline
Port Guard
 
Join Date: Jun 2021
Posts: 13
Default

Quote:
Originally Posted by bsd-keith View Post
To give a size in MB or GB, use +1M, +1G (+5M, +9G) etc.

(At least, that works on OpenBSD, should be the same for FreeBSD).

Yes, re install with the sizes you want.
Do you mean this?
Code:
c [part]
Change the size of an existing partition. If no partition is specified, the user will be prompted for one. The new size may be in terms of the aforementioned units and may also be prefixed with ‘+’ or ‘-’ to change the size by a relative amount.
by 'over again' I meant to re-partion the filesystems again (disklabel -E) NOT a fresh installation.

Last edited by lattimro; 3rd December 2022 at 01:38 PM.
Reply With Quote
  #6   (View Single Post)  
Old 3rd December 2022
lattimro lattimro is offline
Port Guard
 
Join Date: Jun 2021
Posts: 13
Default

Reporting free 5.2M when "c" unused is 16,384M because I entered wrong size (5.2 M) when I resized. How to reclaim all 16,384M?

Last edited by lattimro; 3rd December 2022 at 01:34 PM.
Reply With Quote
  #7   (View Single Post)  
Old 3rd December 2022
bsd-keith bsd-keith is offline
Real Name: Keith
Open Source Software user
 
Join Date: Jun 2014
Location: Surrey/Hants Border, England
Posts: 275
Default

What I meant was to do a completely new installation, it's easier than trying to change an installed system.
__________________
Linux since 1999, & also a BSD user.
Reply With Quote
  #8   (View Single Post)  
Old 3rd December 2022
lattimro lattimro is offline
Port Guard
 
Join Date: Jun 2021
Posts: 13
Default

Quote:
Originally Posted by bsd-keith View Post
What I meant was to do a completely new installation, it's easier than trying to change an installed system.
right but I am here trying to learn something, I was just curious if the unused space could be reclaim and partitions resized accordingly. I know a 20' fresh installation save days of headaches but ... humans like challenges right?
Thanks for trying anyway ...
Reply With Quote
  #9   (View Single Post)  
Old 3rd December 2022
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,854
Default

If you examine the output from disklabel(8) using sector counts -- that is, without using "m" or "g" to print the partition layout -- you will more easily be able to see if there are any unallocated sectors.

The growfs(8) utility can increase the size of a partition, but only if there are adjacent unallocated sectors that follow. The only other way to change an existing partition's size is to back it up, delete and reallocate it, then restore.
Reply With Quote
Old 4th December 2022
lattimro lattimro is offline
Port Guard
 
Join Date: Jun 2021
Posts: 13
Default

Quote:
Originally Posted by jggimi View Post
If you examine the output from disklabel(8) using sector counts -- that is, without using "m" or "g" to print the partition layout -- you will more easily be able to see if there are any unallocated sectors.

The growfs(8) utility can increase the size of a partition, but only if there are adjacent unallocated sectors that follow. The only other way to change an existing partition's size is to back it up, delete and reallocate it, then restore.
I was able to reclaim more sectors than 33 554 368, and I created a newfs wd0i and mount to /usr/src (as it can be seen in the screenshot) add to fstab, reboot, all good. Next step was to increase wd0f mounted on /usr.

Thanks jggimi, much appreciated, I noticed I have issues with "c" increase size of wd0f. Could be because m or g or adjacent unallocated sectors or both. However I can shrink partition (but not saved just testing "c" command).

The last question on this thread, please can you show me the adjacent unallocated on my label. I think it is the partition with the biggest offset 33 543 712 wd0i

I think I will try to dump/restore method.

I do not have room on / so I mounted newly created 8G wd0i partition on /mnt and dump|restore
Code:
dump -0af - /usr | restore -rf - | rm restoresymtable
BTW, there is no "-" (dash) before -rf in the correct example usage below:

Quote:
-r Restore (rebuild) a file system. The target file system should be made pristine with newfs(8), mounted, and the user changed working directory into the pristine file system before starting the restoration of the initial level 0 backup. If the level 0 restores successfully, the -r flag may be used to restore any necessary incremental backups on top of the level 0. The -r flag precludes an interactive file extraction and can be detrimental to one's health (not to mention the disk) if not used carefully. An example of correct usage:
# newfs /dev/rsd0g
# mount /dev/sd0g /mnt
# cd /mnt
# restore rf /dev/rst0
Going forward, here is the output of dump|restore:
Changed in fstab /usr from (in my disklabel) "f" to "i". Reboot and first no X. At login prompt I can't log in because it is looking for /usr/local/bin/bash and I think it can't read /usr. However, I rebooted to single-user (boot -s) and I have access to /.
Here's the disklabel and fstab (see attached). Note du output proved the dump |restore "copied" to /usr
Not sure what I'm doing but ... I changed the SHELL for root to /bin/ksh and exit single-user and continue booting ...
and got X, all good (see attached)
Attached Images
File Type: png Screenshot_2022-12-03_21-34-19.png (178.8 KB, 6 views)
File Type: png Screenshot_2022-12-04_20-26-04.png (205.2 KB, 3 views)
File Type: png Screenshot_2022-12-04_20-52-27.png (154.5 KB, 2 views)
File Type: png Screenshot_2022-12-04_21-06-26.png (114.4 KB, 2 views)
File Type: png Screenshot_2022-12-04_21-36-36.png (229.8 KB, 2 views)

Last edited by lattimro; 5th December 2022 at 02:40 AM.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
removing unused system daemons from the base install (for security) puffyborg OpenBSD Security 2 24th August 2018 08:15 PM
Windows exploit protection mostly unused J65nko News 0 4th July 2010 09:22 PM
ccd/vinum/? & unused drive space diablito OpenBSD General 1 7th June 2010 06:23 PM
Requesting a refund of an unused not wanted MS Windows license guitarscn Off-Topic 11 29th January 2010 12:18 AM
eclipse how to find unused ports? disappearedng FreeBSD General 0 17th November 2008 12:34 AM


All times are GMT. The time now is 02:40 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick