Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Apr 2006 13:04:41 +0900
From:      Ian Jefferson <ijeff@sandbox.ca>
To:        Low Kian Seong <freebsd.low@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: How do you resize an existing partition / slice ?
Message-ID:  <57CE9139-2593-4EA0-8B5F-1DA845ECC82F@sandbox.ca>
In-Reply-To: <a6baaade0604281124r5427d593j340d8531a95ab278@mail.gmail.com>
References:  <a6baaade0604281124r5427d593j340d8531a95ab278@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
If you have extra disk space it's fairly straightforward to use dump/ 
restore and re-partition.

I recently found myself desiring to re-slice my disk from a single  
slice to 5 slices.

The basics were to dump the contents of my root, var, and usr  
partitions to 3 files on another disk.  I booted from a distribution  
CD and installed a new OS on slice 2 with the default partitions.   
Slice 1 became a 1g partition for DOS if the urge struck me later,  
Slice 2 was a new OS and slice 3 was for the old/existing OS.

I relabeled my 2nd slice and restored the original OS to the various  
partitions.  The only thing I forgot was to re-name the partitions in  
the /etc/fstab on my old OS. The change in slice number went like this:

/dev/ad0s1b             none            swap    sw               
0       0
/dev/ad0s1a             /               ufs     rw               
1       1
/dev/ad0s1e             /tmp            ufs     rw               
2       2
/dev/ad0s1f             /usr            ufs     rw               
2       2
/dev/ad0s1d             /var            ufs     rw               
2       2

Became

/dev/ad0s3b             none            swap    sw               
0       0
/dev/ad0s3a             /               ufs     rw               
1       1
/dev/ad0s3e             /tmp            ufs     rw               
2       2
/dev/ad0s3f             /usr            ufs     rw               
2       2
/dev/ad0s3d             /var            ufs     rw               
2       2


In your case if you want just the original slice you would do  
something like:

boot from the live filesystem CD
fdisk your drive,
label (partition) your drive to the configuration you want
newfs each new partition,
mount the drive you used for backup
mount each of the new partitions of your original disk
Restore each of the partitions in turn.

Reboot from the original disk.

This looks a bit complex but is not too bad at all.  This dump/ 
restore or even tar'ing filesystems is something we used a long time  
ago to "image" NeXT systems.  It's been quite reliable for me.  Your  
mileage may vary.

IJ


On Apr 29, 2006, at 3:24 AM, Low Kian Seong wrote:

> Dear all,
>
> Like the subject shows, I would just like to know how do i resize an
> existing partition or slice, ermm with minimum loss of data of course.
>
> Thanks.
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions- 
> unsubscribe@freebsd.org"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?57CE9139-2593-4EA0-8B5F-1DA845ECC82F>