summaryrefslogtreecommitdiffstats
path: root/en-US/Free_Space.xml
blob: 54c6f026618bff08b11c112ba604f98261a95481 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "Fedora_Multiboot_Guide.ent">
%BOOK_ENTITIES;

]>
<section id="freespace">
  <title>Making Room for Fedora</title>
  <para>
    Fedora requires a volume of <emphasis>unallocated</emphasis> storage space for installation. To make room for Fedora, both the existing filesystem and the partition it resides on must be resized
  </para>
  <section id="freespace-anaconda">
    <title>Using the Fedora Installer to resize partitions</title>
    <para>http://docs.fedoraproject.org/en-US/Fedora/19/html/Installation_Guide/reclaim_space-x86.html
    </para>
<!-- "An introduction to Disk Partitions"
http://docs.fedoraproject.org/en-US/Fedora/19/html/Installation_Guide/ch-partitions-x86.html
-->
  </section>
  
  <section>
    <title>Resizing an NTFS filesystem the command line</title>
    <para>
      This section explains using tools provided by Fedora to resize an NTFS partition. A terminal window from a liveCD can be used.
    </para>
    <procedure>
      <title>
	Selecting and resizing a partition.
      </title>
      <step>
	<para>
	  Show available filesystems:
	  <screen>
# <command>blkid</command>
/dev/sda1: SEC_TYPE="msdos" UUID="32AE-E651" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="0315942d-8c2c-414f-a560-cfa499494a72" 
/dev/sda2: UUID="593153ae-2b67-4a5b-9efa-fa3954953abd" TYPE="ext4" PARTUUID="68cadad8-6de2-4ef7-96ff-f58e5114fdcc" 
/dev/sda3: UUID="P2xKTQ-aQWG-z2Uv-jSw5-kkUK-SN5Q-cNf3PI" TYPE="LVM2_member" PARTUUID="7ba7ed40-b43f-4e71-b83e-51629bf7db47" 
/dev/sda5: UUID="44B6BAD1B6BAC2AA" TYPE="ntfs" PARTUUID="9c62d1dc-dedd-4d4c-9728-5f2ef69f2b42" 
          </screen>
        </para>
      </step>

      <step>
	<para>
	  <systemitem class="filesystem">ntfs</systemitem> partitions indicate the existing Windows installation. Examine the partitions on the <filename>/dev/sda</filename> drive.
          <screen>
# <command>parted /dev/sda print</command>
Model: ATA ST9320328CS (scsi)
Disk /dev/sda: 320GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: pmbr_boot

Number  Start   End    Size    File system  Name                          Flags
 1      1049kB  211MB  210MB   fat16        EFI System Partition          boot
 2      211MB   735MB  524MB   ext4
 3      735MB   119GB  118GB
 4      119GB   119GB  134MB                Microsoft reserved partition  msftres
 5      119GB   215GB  96.2GB  ntfs
          </screen>
	</para>
      </step>

      <step>
	<para>
	  Partition number 5 is a large filesystem, and probably has some free space to share. Check how much of that space is in use.
          <screen>
# <command>ntfsresize --info /dev/sda5</command>
ntfsresize v2013.1.13 (libntfs-3g)
Device name        : /dev/sda5
NTFS volume version: 3.1
Cluster size       : 4096 bytes
Current volume size: 96234107392 bytes (96235 MB)
Current device size: 96234110976 bytes (96235 MB)
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Space in use       : 29222 MB (30.4%)
Collecting resizing constraints ...
You might resize at 29221265408 bytes or 29222 MB (freeing 67013 MB).
Please make a test run using both the -n and -s options before real resizing!
          </screen>
        </para>
        </step>
        <step>
          <para>
            Resize the filesystem. Make sure to balance the available space, a very full filesystem can cause problems for any operating system.
            <screen>
# <command>ntfsresize --size 40G /dev/sda5</command>
ntfsresize v2013.1.13 (libntfs-3g)
Device name        : /dev/sda5
NTFS volume version: 3.1
Cluster size       : 4096 bytes
Current volume size: 96234107392 bytes (96235 MB)
Current device size: 96234110976 bytes (96235 MB)
New volume size    : 39999996416 bytes (40000 MB)
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Space in use       : 29222 MB (30.4%)
Collecting resizing constraints ...
Needed relocations : 0 (0 MB)
WARNING: Every sanity check passed and only the dangerous operations left.
Make sure that important data has been backed up! Power outage or computer
crash may result major data loss!
Are you sure you want to proceed (y/[n])? y
Schedule chkdsk for NTFS consistency check at Windows boot time ...
Resetting $LogFile ... (this might take a while)
Updating $BadClust file ...
Updating $Bitmap file ...
Updating Boot record ...
Syncing device ...
Successfully resized NTFS on device '/dev/sda5'.
You can go on to shrink the device for example with Linux fdisk.
IMPORTANT: When recreating the partition, make sure that you
  1)  create it at the same disk sector (use sector as the unit!)
  2)  create it with the same partition type (usually 7, HPFS/NTFS)
  3)  do not make it smaller than the new NTFS filesystem size
  4)  set the bootable flag for the partition if it existed before
Otherwise you won't be able to access NTFS or can't boot from the disk!
If you make a mistake and don't have a partition table backup then you
can recover the partition table by TestDisk or Parted's rescue mode.        
            </screen>
          </para>
        </step>
      </procedure>

      <procedure>
        <title>Resizing the partition</title>
        <step>
          <para>
            To make sure that the partition is recreated accurately, work using sectors as units instead of bytes. The first figure we need is the sector the filesystem starts on.
            <screen>
# <command>parted /dev/sda unit s print</command>
Model: ATA ST9320328CS (scsi)
Disk /dev/sda: 625142448s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: pmbr_boot

Number  Start       End         Size        File system  Name                          Flags
 1      2048s       411647s     409600s     fat16        EFI System Partition          boot
 2      411648s     1435647s    1024000s    ext4
 3      1435648s    232122367s  230686720s
 4      232122368s  232384511s  262144s                  Microsoft reserved partition  msftres
 5      232384512s  420341759s  187957248s  ntfs
 6      420341760s  420343807s  2048s                                                  bios_grub
 7      420343808s  421367807s  1024000s    ext4
 8      421367808s  625141759s  203773952s
            </screen>
          </para>
          <para>
            The partition starts on sector <literal>232384512</literal>, and the sector size is <literal>512&nbsp;bytles</literal>
          </para>
        </step>
        <step>
          <para>
            Calculate the size of the filesystem in sectors, and the end of the new partition
            <itemizedlist>
              <listitem>
                <para>
                  After resizing, the filesystem is marked as <emphasis>dirty</emphasis> so it will be checked on the next Windows boot. Clear this flag so that we can run further commands.
                  <screen>
# <command>ntfsfix -d /dev/sda5</command>
Mounting volume... OK
Processing of $MFT and $MFTMirr completed successfully.
Checking the alternate boot sector... OK
NTFS volume version is 3.1.
NTFS partition /dev/sda5 was processed successfully.   
                  </screen>
                </para>
              </listitem>
              <listitem>
                <para>Find the cluster size and number of clusters.
                  <screen>
# <command>ntfsinfo -m /dev/sda5|grep Cluster</command>
    Cluster Size: 4096
    Volume Size in Clusters: 9765624
    Compression Block Clusters: 0
    Free Clusters: 2631945 (27.0%)
                  </screen>
                </para>
              </listitem>
              <listitem>
		<para>
		  Calculate the size in sectors of the new filesystem.
                  <equation>
                    <title>Filesystem size in sectors</title>
                    <mathphrase>
                      4096 bytes per cluster &times; 9765624 total clusters &divide; 512 bytes per sector = 78124992 sectors
                    </mathphrase>
                  </equation>
		</para>
	      </listitem>
              <listitem>
                <para>
                  Find the end of the new partition.
                  <equation>
                    <title>End sector of new partition</title>
                    <mathphrase>
                      232384512 start + 78124992 filesystem = 310509504 end sector
                    </mathphrase>
                  </equation>
                </para>
              </listitem>
            </itemizedlist>
          </para>
        </step>

        <step>
          <para>
            The <systemitem class="filesystem">ntfs</systemitem> filesystems on the <filename>/dev/sda</filename>. Using the <literal>s</literal> after the number ensures <command>parted</command> uses sectors as the unit.
            <screen>
 <command># parted /dev/sda</command>
GNU Parted 3.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
(parted) rm 5                                                             
(parted) mkpart
Partition name?  []? windowsdisk
File system type?  [ext2]? ntfs                                           
Start? 232384512s                                                         
End? 310509504s      
(parted) quit
            </screen>
          </para>
        </step>
        <step>
	  <para>
	    Check the partition table to confirm the free space is available, and exit <command>parted</command>.
	    <screen>
(parted) print free                                                       
Model: ATA ST9320328CS (scsi)
Disk /dev/sda: 320GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: pmbr_boot

Number  Start   End     Size    File system  Name                          Flags
        17.4kB  1049kB  1031kB  Free Space
 1      1049kB  211MB   210MB   fat16        EFI System Partition          boot
 2      211MB   735MB   524MB   ext4
 3      735MB   119GB   118GB
 4      119GB   119GB   134MB                Microsoft reserved partition  msftres
 5      119GB   159GB   40.0GB  ntfs
        159GB   215GB   56.2GB  Free Space
 
(parted) quit
	  </screen>
	</para>
      </step>
    </procedure>
  </section>
  
</section>