From owner-freebsd-questions@FreeBSD.ORG Sat May 16 11:10:26 2015 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3BB3057A for ; Sat, 16 May 2015 11:10:26 +0000 (UTC) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C0BAC18AF for ; Sat, 16 May 2015 11:10:25 +0000 (UTC) Received: from r56.edvax.de (port-92-195-97-206.dynamic.qsc.de [92.195.97.206]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx02.qsc.de (Postfix) with ESMTPS id BF653251CB; Sat, 16 May 2015 13:10:23 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id t4GBAN2U002732; Sat, 16 May 2015 13:10:23 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Sat, 16 May 2015 13:10:23 +0200 From: Polytropon To: Avinash Sonawane Cc: freebsd-questions@freebsd.org Subject: Re: Swap partition for FreeBSD Message-Id: <20150516131023.fbd69d58.freebsd@edvax.de> In-Reply-To: References: <55570A54.2080107@FreeBSD.org> <20150516123303.8d9cf0dc.freebsd@edvax.de> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2015 11:10:26 -0000 On Sat, 16 May 2015 16:16:13 +0530, Avinash Sonawane wrote: > I have 4 Primary partitions. Out of which one ada0s1 has FreeBSD, > ada0s2 has Debian, ada0s3 is one extra Primary partition (which > currently holds data) and ada0s4 is an extended partition (to create > further logical partitions like linux-swap, data partitions etc.) Okay, so you should be able to put the swap into ada0s1. > >> After searching a bit on the web I came to know that default kernel > >> build options specify "options GEOM_PART_EBR_COMPAT" which prevents > >> GEOM from editing EBR partition schemes. So to create a partition of > >> type freebsd-swap in extended partition it looks like I need to > >> recompile the kernel without the GEOM_PART_EBR_COMPAT kernel option. > > > > It seems to be that way. Using "extended DOS partitions" has never > > been a good idea. :-) > > > > However, as I initially wrote, this isn't _needed_ when you put > > the swap partition into the slice where the rest of your FreeBSD > > installation resides. You can have up to 4 "DOS primary partitions" > > (slices), and each one could carry an independent OS install. > > I have Freebsd installed in ada0s1a so can I create ada0s1b inside > ada0s1 to have freebsd-swap? How do I do that? Using bsdlabel, for example. As shown in the manpage as well as in the "legacy parts" of the FreeBSD handbook, you'd have to modify the partition table entry to include a swap space. This typically involves either re-installing, or the more common dump + restore process (for ada0s1a, /, holding your installation). This is a comparable process: https://www.freebsd.org/doc/en/books/handbook/install-steps.html See 3.6.5. Also read "man bsdlabel". You will use a command like # bsdlabel -e ada0s1 to make the changes to how the slice will be used. You have to come from something like this: # size offset fstype [fsize bsize bps/cpg] a: 1000000 16 4.2BSD 2048 16384 5128 c: 1000016 0 unused 0 0 to something like this: # size offset fstype [fsize bsize bps/cpg] a: 900000 16 4.2BSD 2048 16384 5128 b: 100000 900000 swap c: 1000016 0 unused 0 0 Numbers are nonsense here. :-) You need to create a type "swap" partition, and / will be resized in that process of course. Space will be consumed from ada0s1, not ada0s6. I surely don't have to mention that it's considered mandatory to have a good backup before making changes with such impact. > Or should I create ada0s6b as swap partition inside ada0s6 slice? That is probably also possible, but I've never actually used "extended DOS partitions" in production, so I can't tell you if FreeBSD will deal with them in the same way as Linux. But it should be possible. I don't know if it's possible to "dynamically resize" the / partition without data loss, that's why I mentioned backups. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...