FreeBSD Bugzilla – Attachment 139967 Details for
Bug 186377
new handbook section - growing disks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 6.03 KB, created by
Allan Jude
on 2014-02-02 15:30:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Allan Jude
Created:
2014-02-02 15:30:01 UTC
Size:
6.03 KB
patch
obsolete
>Index: disks/chapter.xml >=================================================================== >--- disks/chapter.xml (revision 43726) >+++ disks/chapter.xml (working copy) >@@ -252,6 +252,143 @@ > <screen>&prompt.root; <userinput>mount /newdisk</userinput></screen> > </sect1> > >+ <sect1 xml:id="disks-growing"> >+ <info> >+ <title>Resizing and Growing Disks</title> >+ >+ <authorgroup> >+ <author> >+ <personname> >+ <firstname>Allan</firstname> >+ <surname>Jude</surname> >+ </personname> >+ <contrib>Originally contributed by </contrib> >+ </author> >+ </authorgroup> >+ </info> >+ >+ <indexterm> >+ <primary>disks</primary> >+ <secondary>resizing</secondary> >+ </indexterm> >+ >+ <para>This section describes how to resize (grow) an existing disk >+ in &os;. This procedure is most common with virtual machines, >+ but can also apply to images written to USB devices or other >+ cases where the partitions written to a disk do not match the >+ actual size of the disk.</para> >+ >+ <para>Determine the device name of the disk that needs to be >+ resized by inspecting <filename>/var/run/dmesg.boot</filename>. >+ In this example, there is only one <acronym>SATA</acronym> disk >+ in the system, so the drive will appear as >+ <filename>ada0</filename>.</para> >+ >+ <indexterm><primary>partitions</primary></indexterm> >+ <indexterm> >+ <primary><command>gpart</command></primary> >+ </indexterm> >+ >+ <para>List the partitions on the disk to determine what needs to >+ be done to resize the desired partition:</para> >+ >+ <screen>&prompt.root; <command>gpart show <replaceable>ada0</replaceable></command> >+=> 34 83886013 ada0 GPT (48G) [CORRUPT] >+ 34 128 1 freebsd-boot (64k) >+ 162 79691648 2 freebsd-ufs (38G) >+ 79691810 4194236 3 freebsd-swap (2G) >+ 83886046 1 - free - (512B)</screen> >+ >+ <note> >+ <para>If the disk was formatted with the <link >+ xlink:href="http://en.wikipedia.org/wiki/GUID_Partition_Table"> >+ <acronym>GPT</acronym></link> partitioning scheme, it may show >+ as corrupted because <acronym>GPT</acronym> stores a backup >+ of the partition table at the end of the drive, which has now >+ moved.</para> >+ >+ <screen>&prompt.root; <command>gpart recover <replaceable>ada0</replaceable></command> >+ada0 recovered</screen> >+ </note> >+ >+ <para>Now the additional space on the disk is available:</para> >+ >+ <screen>&prompt.root; <command>gpart show <replaceable>ada0</replaceable></command> >+=> 34 102399933 ada0 GPT (48G) >+ 34 128 1 freebsd-boot (64k) >+ 162 79691648 2 freebsd-ufs (38G) >+ 79691810 4194236 3 freebsd-swap (2G) >+ 83886046 18513921 - free - (8.8G)</screen> >+ >+ <para>It is only possible to resize a partition into contiguous >+ free space, however the last partition on the disk is the swap >+ partition, rather than the partition to be resized. Since swap >+ does not contain any non-volatile data, it can safely be deleted >+ and recreated after.</para> >+ >+ <screen>&prompt.root; <command>swapoff <replaceable>/dev/ada0p3</replaceable></command> >+&prompt.root; <command>gpart delete -i <replaceable>3</replaceable> <replaceable>ada0</replaceable></command> >+ada0p3 deleted >+&prompt.root; <command>gpart show <replaceable>ada0</replaceable></command> >+=> 34 102399933 ada0 GPT (48G) >+ 34 128 1 freebsd-boot (64k) >+ 162 79691648 2 freebsd-ufs (38G) >+ 79691810 22708157 - free - (10G)</screen> >+ >+ <para>Next resize the partition, leaving room to recreate a swap >+ partition of the desired size.</para> >+ >+ <note> >+ <para>There is risk involved with modifying a live file system, >+ it is best to perform the following steps while running off of >+ a live CD or USB device. However it can be done on a live >+ system with the following work around: >+ >+ <screen>&prompt.root; <command>sysctl kern.geom.debugflags=16</command></screen> >+ </para> >+ </note> >+ >+ <screen>&prompt.root; <command>gpart resize -i <replaceable>2</replaceable> -s <replaceable>47G</replaceable> <replaceable>ada0</replaceable></command> >+ada0p2 resized >+&prompt.root; <command>gpart show <replaceable>ada0</replaceable></command> >+=> 34 102399933 ada0 GPT (48G) >+ 34 128 1 freebsd-boot (64k) >+ 162 98566144 2 freebsd-ufs (47G) >+ 98566306 3833661 - free - (1.8G)</screen> >+ >+ <para>Next, recreate the swap partition:</para> >+ >+ <screen>&prompt.root; <command>gpart add -t freebsd-swap <replaceable>ada0</replaceable></command> >+ada0p3 added >+&prompt.root; <command>gpart show <replaceable>ada0</replaceable></command> >+=> 34 102399933 ada0 GPT (48G) >+ 34 128 1 freebsd-boot (64k) >+ 162 98566144 2 freebsd-ufs (47G) >+ 98566306 3833661 3 freebsd-swap (1.8G) >+&prompt.root; <command>swapon <replaceable>/dev/ada0p3</replaceable></command></screen> >+ >+ <para>Finally, grow the UFS file system on the resized >+ partition:</para> >+ >+ <note> >+ <para>growing a live UFS file system is only possible in &os; >+ 10.0-RELEASE and later, for earlier versions, the file system >+ must not be mounted.</para> >+ </note> >+ >+ <screen>&prompt.root; <command>growfs <replaceable>/dev/ada0p2</replaceable></command> >+Device is mounted read-write; resizing will result in temporary write suspension for /. >+It's strongly recommended to make a backup before growing the file system. >+OK to grow filesystem on /dev/ada0p2, mounted on /, from 38GB to 47GB? [Yes/No] <userinput>Yes</userinput> >+super-block backups (for fsck -b #) at: >+ 80781312, 82063552, 83345792, 84628032, 85910272, 87192512, 88474752, >+ 89756992, 91039232, 92321472, 93603712, 94885952, 96168192, 97450432</screen> >+ >+ <para>The partition has now been resized to make use of all >+ available space on the disk.</para> >+ >+ </sect1> >+ > <sect1 xml:id="usb-disks"> > <info> > <title>USB Storage Devices</title>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 186377
: 139967