4.  Partitioning

4.1.  Automated Partitioning

For the automated partitioning to be completed, only the sizes and mount points of partitions can be provided. All other data needed for successful partitioning can be calculated during installation if they were not provided in the control file.

If no partitions are defined and the specified drive is also the drive where the root partition should be created, the following partitions are created automatically:

  • /boot

    Size of the /boot is determined by the architecture of the target system.

  • swap

    Size of the swap partitions is determined by the amount of memory available in the system.

  • / (root partition)

    Size of the / (root partition) is the space left after creating swap and /boot.

Depending on the initial status of the drive and how it was previously partitioned, it is possible to create the default partitioning in the following ways:

  • Use free space

    If the drive is already partitioned, it is possible to create the new partitions using the available space on the hard drive. This requires the availability of enough space for all selected packages in addition to swap.

  • Reuse all available space

    This option will lead to the deletion of all existing partitions (Linux and non-Linux partitions).

  • Reuse all available Linux partitions

    This option will lead to the deletion of existing Linux partitions. All other partitions (i.e. Windows) will be kept. Note that this works only if the Linux partitions are at the end of the device.

  • Reuse only specified partitions

    This option will lead to the deletion of the specified partitions. The selection of the partitions scheduled for deletion should be started from the last available partition.

Repartitioning using only some of the existing partitions can be accomplished only if the region selected to be partitioned exists at the end of the device and only with neighboring partitions. This means that you cannot repartition a region which contains a partition that should not be touched in the middle.

[Caution]Important Notice

The value provided in the use property determines how existing data and partitions are treated. The value all means that ALL data on the disk will be erased. Make backups and use the confirm property if you are going to keep some partitions with important data. This is automated installation and no pop-ups will notify you about partitions being deleted.

In case of the presence of multiple drives in the target system, all drives must be identified with their device names and how the partitioning should be performed.

Partition sizes can be given in Gigabytes, Megabytes or can be set to a flexible value using the keywords auto and max. max is used to fill a partition to the maximal available space on a drive (Which mean that the partition should be the last one on the drive). auto can be used to determine the size of a swap or boot partitions depending on the memory available and the type of the system.

A fixed size can be given as shown below:

1GB will create a partition with 1 GB size. 1500MB will create a partition which is 1.5 GB big.

Example 4.6. Automated partitioning

The following is an example of a single drive system, which is not pre-partitioned and should be automatically partitioned according to the described pre-defined partition plan:

  
  <partitioning  config:type="list">
    <drive>
      <device>/dev/hda</device>       
      <use>all</use>
    </drive>
  </partitioning>

  
	  

A more detailed example shows how existing partitions and multiple drives are handled.

Example 4.7. Detailed automated partitioning

  <partitioning  config:type="list">
  <drive>
    <device>/dev/hda</device>            
    <partitions config:type="list">
      <partition>
	<mount>/</mount>
	<size>5gb</size>
      </partition>
      <partition>
	<mount>swap</mount>
	<size>1gb</size>
      </partition>
    </partitions>
  </drive>
  <drive>
    <device>/dev/hdb</device>
    <use>all</use>
    <partitions config:type="list">
      <partition>
	<filesystem  config:type="symbol">reiser</filesystem>
	<mount>/data1</mount>
	<size>15gb</size>	
      </partition>
      <partition>
	<filesystem  config:type="symbol">jfs</filesystem>
	<mount>/data2</mount>
	<size>auto</size>	
      </partition>
    </partitions>
    <use>free</use>
  </drive>
</partitioning>

      	  

4.2. Advanced Partitioning features

4.2.1. Mount Options

By default a file system which is to be mounted is identified in /etc/fstab by the device name. This identification can be changed so the file system is found by searching for a UUID or a volume label. Note that not all file systems can be mounted by UUID or a volume label. To specify how a partition is to be mounted, use the mountby property which has the symbol type. Possible options are:

  • device (default)

  • label

  • UUID

If you choose to mount the partition using a label, the name entered in the label property is used as the volume label.

Add any legal mount option allowed in the fourth field of /etc/fstab. Multiple options are separated by commas. Possible fstab options:

  • Mount Read-Only (ro): No writable access to the file system is possible. Default is false.

  • No access time (noatime): Access times are not updated when a file is read. Default is false.

  • Mountable by User (user): The file system may be mounted by an ordinary user. Default is false.

  • Data Journaling Mode (ordered | journal | writeback) : Specifies the journaling mode for file data. journal -- All data is committed into the journal prior to being written into the main file system. ordered -- All data is forced directly out to the main file system prior to its meta data being committed to the journal. writeback -- Data ordering is not preserved.

  • Access Control List (acl): Enable access control lists on the file system.

  • Extended User Attributes (user_xattr): Allow extended user attributes on the file system.

Example 4.8. Mount Options

	    
  <partitions config:type="list">
    <partition>   
      <filesystem config:type="symbol">reiser</filesystem>
      <format config:type="boolean">true</format>
      <fstopt>ro,noatime,user,data=ordered,acl,user_xattr</fstopt>
      <mount>/local</mount>
      <mountby config:type="symbol">uuid</mountby>
      <partition_id config:type="integer">131</partition_id>
      <size>10gb</size>
    </partition>
  </partitions>

  
	

4.2.2. Creating Primary and Extended Partitions

By default, AutoYaST will create an extended partition and will add all other new partitions as logical devices. It is possible however to instruct AutoYaST to create a certain partition as a primary or as extended partition. Additionally, it is possible to specify the size of a partition using sectors instead of the size in Mbytes.

The properties partition_id and partition_type control such behavior. To specify the size in sectors, the list resource region can be used.

Example 4.9. Advanced Automated partitioning

	    
  <partitioning config:type="list">
    <drive>
      <device>/dev/hdc</device>
      <partitions config:type="list">
	<partition>
	  <partition_id config:type="integer">5</partition_id>	  
	  <region config:type="list">
	    <region_entry config:type="integer">0</region_entry>
	    <region_entry config:type="integer">16858</region_entry>
	  </region>            
	</partition>
	<partition>
	  <filesystem config:type="symbol">reiser</filesystem>
	  <mount>/</mount>
	  <partition_id config:type="integer">131</partition_id>           
	  <region config:type="list">
	    <region_entry config:type="integer">0</region_entry>
	    <region_entry config:type="integer">2081</region_entry>
	  </region>           
	</partition>
	<partition>
	  <mount>swap</mount>
	  <partition_id config:type="integer">130</partition_id>          
	  <region config:type="list">
	    <region_entry config:type="integer">2081</region_entry>
	    <region_entry config:type="integer">781</region_entry>
	  </region>
	</partition>
      </partitions>
      <use>all</use>
    </drive>
  </partitioning>

	
      

The last example only makes sense if you exactly know the boundaries of the partitions and it does only make sense if you are creating an exact copy of a system, for example when cloning. The first region entry in the list is the beginning of the region, the second represents the length of the region.

The following example lets you create an extended partition with a custom size.

Example 4.10.  Creating custom extended partitions

      	    
  <partitioning config:type="list">
    <drive>
      <device>/dev/hdc</device>
      <partitions config:type="list">
	<partition>
	  <filesystem config:type="symbol">ext2</filesystem>
	  <mount>/boot</mount>
	  <partition_id config:type="integer">131</partition_id>
	  <partition_nr config:type="integer">2</partition_nr>
	  <size>50mb</size>
	</partition>
	<partition>
	  <mount>swap</mount>
	  <partition_id config:type="integer">130</partition_id>
	  <partition_nr config:type="integer">3</partition_nr>
	  <size>100mb</size>
	</partition>
	<partition>
	  <partition_id config:type="integer">15</partition_id>
	  <partition_nr config:type="integer">4</partition_nr>
	  <size>3000mb</size>
	</partition>
	<partition>
	  <filesystem config:type="symbol">ext2</filesystem>
	  <mount>/</mount>
	  <partition_id config:type="integer">131</partition_id>
	  <partition_nr config:type="integer">5</partition_nr>
	  <size>1gb</size>
	</partition>
      </partitions>
      <use>free</use>
    </drive>
  </partitioning>

  </install>

      

4.2.3. Keeping Specific Partitions

In some cases you might choose to keep some partitions untouched and only format specific target partitions, rather than creating them from scratch. This might be the case of Linux installations have to co-exist with another operating system or if certain partitions contain data that you wish to keep untouched.

Such scenarios require certain knowledge about the target systems and hard drives. Depending on the scenario, you might need to know the exact partition table of the target hard drive with partition id's, sizes and numbers. With such data you can tell AutoYaST to keep certain partitions, format others and create new partitions if needed.

The following example will keep partitions 1, 2 and 5 and delete partition 6 to create two new partitions. All kept partitions will be only formatted.

Example 4.11.  Keeping partitions

	    
  <install>

    <partitioning config:type="list">
      <drive>
        <device>/dev/hdc</device>
        <partitions config:type="list">
          <partition>
            <create config:type="boolean">false</create>
            <format config:type="boolean">true</format>
            <mount>/</mount>
            <partition_nr config:type="integer">1</partition_nr>
          </partition>
          <partition>
            <create config:type="boolean">false</create>
            <format config:type="boolean">false</format>
            <partition_nr config:type="integer">2</partition_nr>
            <mount>/space</mount>
          </partition>
          <partition>
            <create config:type="boolean">false</create>
            <format config:type="boolean">true</format>
            <filesystem config:type="symbol">swap</filesystem>
            <partition_nr config:type="integer">5</partition_nr>
            <mount>swap</mount>
          </partition>
          <partition>
            <format config:type="boolean">true</format>
            <mount>/space2</mount>
            <size>50mb</size>
          </partition>
          <partition>
            <format config:type="boolean">true</format>
            <mount>/space3</mount>
            <size>max</size>
          </partition>
        </partitions>
        <use>6</use>
      </drive>
    </partitioning>
  </install>


      

The last example requires exact knowledge about the existing partition table and about the partition numbers of those partitions that should be kept. In some cases however, such data might be not available, especially in a mixed hardware environment with different hard drive types and configurations. The following scenario is for a system with a non-Linux OS with a designated area for a Linux installation.

Figure 4.1. Keeping partitions

Keeping partitions

In this scenario and as shown in figure “Keeping partitions” , AutoYaST should not in any case create any new partitions, instead it should search for certain partition types on the system and use them according to the partitioning plan in the control file. No partition numbers are given in this case, only the mount points and the partition types (Additional configuration data can be provided, for example file system options, encryption and filesystem type)

Example 4.12.  Auto-detection of partitions to be kept.

   
  <install>

    <partitioning config:type="list">
      <drive>
        <partitions config:type="list">
          <partition>
            <create config:type="boolean">false</create>
            <format config:type="boolean">true</format>
            <mount>/</mount>
            <partition_id config:type="integer">131</partition_id>
          </partition>
          <partition>
            <create config:type="boolean">false</create>
            <format config:type="boolean">true</format>
            <filesystem config:type="symbol">swap</filesystem>
            <partition_id config:type="integer">130</partition_id>
            <mount>swap</mount>
          </partition>
        </partitions>
      </drive>
    </partitioning>

  </install>

4.3. Using existing mount table (fstab)

[Note]New Feature

This option will allow the AutoYaST to use an existing /etc/fstab and use the partition data from from a previous installation. All partitions are kept and no new partitions are created. The found partitions will be formatted and mounted as specified in /etc/fstab found on a Linux root partition.

Although the default behaviour is to format all partitions, it is also possible to leave some partitions untouched and only mount them, for example data partitions. If multiple installations are found on the system (multiple root partitions with different fstab files, the installation will abort, unless the desired root partition is configured in the control file. The following example illustrates how this option can be used:

Example 4.13.  Reading existing /etc/fstab

  
  <install>
    <partitioning_advanced>
      <fstab>
	<!-- Read data from existing fstab. If multiple root partitions are
	found, use the one specified below. Otherwise the first root
	partition is taken -->
	<!-- <root_partition>/dev/hda5</root_partition> -->
	<use_existing_fstab config:type="boolean">true</use_existing_fstab>
	<!-- all partitions found in fstab will be formatted and mounted
	by default unless a partition is listed below with different
	settings -->
	<partitions config:type="list">
	  <partition>
	    <format config:type="boolean">false</format>
	    <mount>/bootmirror</mount>
	  </partition>
	</partitions>
      </fstab>
    </partitioning_advanced>
  </install>

      

4.4.  Logical Volume Manager (LVM)

To configure LVM, first you need to create a physical volume using the normal partitioning method described above.

Example 4.14.  Create LVM Physical Volume

The following example shows how to prepare for LVM in the partitioning resource:

 
  <partitioning config:type="list">
    <drive>
      <device>/dev/sda</device>         
      
      <partitions config:type="list">
	<partition>	  
	  <lvm_group>system</lvm_group>
	  <partition_type>primary</partition_type>
	  <size>max</size>
	</partition>
      </partitions>
      <use>all</use>
    </drive>
  </partitioning>

      

The last example will create a non-formatted partition on device /dev/sda1 of the type LVM and with the volume group system. The partition created will use all available space on this drive.

[Note]Note

Up to SuSE Linux 8.2 the LVM configuration was done in a separate resource. This method for configuring LVM is still supported, however a new and easier way is now possible which allows you to have the LVM configuration directly in the partitioning resource.

Currently it is not possible to configure LVM using the configuration system, instead it is required to add the resource manually as shown in the following example:

Example 4.15.  LVM Logical Volumes (Old syntax)


  <partitioning config:type="list">
    <drive>
      <device>/dev/sda</device>              
      <partitions config:type="list">
	<partition>	
	  <lvm_group>system</lvm_group>
	  <partition_type>primary</partition_type>
	  <size>max</size>
	</partition>
      </partitions>
      <use>all</use>
    </drive>
  </partitioning>

  <lvm config:type="list">
    <lvm_group>
      <lvm_name>system</lvm_name>     
      <logical_volumes config:type="list">
        <lv>
	  <lv_fs>reiser</lv_fs>
	  <lv_mount>/usr</lv_mount>
	  <lv_name>usrlv</lv_name>
	  <lv_size>500mb</lv_size>	  	  
	</lv>
	<lv> 
	  <lv_fs>reiser</lv_fs>
	  <lv_mount>/opt</lv_mount>
	  <lv_name>optlv</lv_name>
	  <lv_size>1500mb</lv_size>	 	  
	</lv>
	<lv> 
	  <lv_fs>reiser</lv_fs>
	  <lv_mount>/var</lv_mount>
	  <lv_name>varlv</lv_name>
	  <lv_size>200mb</lv_size>	 	  
	</lv>
      </logical_volumes>
      <pesize>4M</pesize>
    </lvm_group>
  </lvm>

      

Using the new method, the above configuration has the following syntax:

Example 4.16.  LVM Logical Volumes (New syntax)


  <partitioning config:type="list">
    <drive>
      <device>/dev/sda</device>             
      <partitions config:type="list">
	<partition>	 
	  <lvm_group>system</lvm_group>
	  <partition_type>primary</partition_type>
	  <size>max</size>
	</partition>
      </partitions>
      <use>all</use>
    </drive>
    <drive>
      <device>/dev/system</device>       
      <is_lvm_vg config:type="boolean">true</is_lvm_vg>
      <partitions config:type="list">
	<partition>
	  <filesystem config:type="symbol">reiser</filesystem>
	  <lv_name>user_lv</lv_name>
	  <mount>/usr</mount>
	  <size>500mb</size>
	</partition>
	<partition>
	  <filesystem config:type="symbol">reiser</filesystem>
	  <lv_name>opt_lv</lv_name>
	  <mount>/opt</mount>
	  <size>1500mb</size>
	</partition>
	<partition>
	  <filesystem config:type="symbol">reiser</filesystem>
	  <lv_name>var_lv</lv_name>
	  <mount>/var</mount>
	  <size>200mb</size>
	</partition>
      </partitions>
      <pesize>4M</pesize>
      <use>all</use>
    </drive>
  </partitioning>

	  

4.5. Software RAID

Using AutoYaST, you can create and assemble software RAID devices. The supported RAID levels are the following:

  • RAID 0: This level increases your disk performance. There is NO redundancy in this mode. If one of the drives crashes, data recovery will not be possible.

  • RAID 1:This mode has the best redundancy. It can be used with two or more disks. This mode maintains an exact copy of all data on all disks. As long as at least one disk is still working, no data is lost. The partitions used for this type of RAID should have approximately the same size.

  • RAID 5: This mode combines management of a larger number of disks and still maintains some redundancy. This mode can be used on three disks or more. If one disk fails, all data is still intact. If two disks fail simultaneously, all data is lost.

  • Multipath:This mode allow access to the same physical device over multiple controller for redundancy against a fault in a controller card. This mode can be used with at least two devices.

As with LVM, you need to create all RAID partitions first and assign the partitions to the RAID device you want to create and additionally you need to specify whether a partition or a device should be configured in the RAID or if it should configured as a Spare device.

[Note]Note

Up to SuSE Linux 8.2 the raid configuration was done in a separate resource. This method for configuring raid devices is still supported, however a new and easier way is now possible which allows the user to have the raid configuration directly in the partitioning resource.

The following example shows a simple RAID1 configuration:

Example 4.17. RAID1 configuration (Old Syntax)



  <partitioning config:type="list">
    <drive>
      <device>/dev/sda</device>
      <partitions config:type="list">
	<partition>
	  <format config:type="boolean">false</format>
	  <partition_id config:type="integer">253</partition_id>	  
	  <raid_name>/dev/md0</raid_name>
	  <raid_type>raid</raid_type>
	  <size>4gb</size>            
	</partition>

	<!-- Here come the regular partitions, i.e. / and swap -->        

      </partitions>
      <use>all</use>
    </drive>
    <drive>
      <device>/dev/sdb</device>
      <use>all</use>
      <partitions config:type="list">
	<partition>
	  <format config:type="boolean">false</format>
	  <partition_id config:type="integer">253</partition_id>	  
	  <raid_name>/dev/md0</raid_name>            
	  <raid_type>raid</raid_type>
	  <size>4gb</size>
	</partition>
      </partitions>
    </drive>
  </partitioning>

  <raid config:type="list">
    <raid_device>
      <chunk_size>4</chunk_size>
      <device_name>/dev/md0</device_name>
      <filesystem config:type="symbol">reiser</filesystem>
      <format config:type="boolean">true</format>      
      <parity_algorithm>left-asymmetric</parity_algorithm>
      <partition_id config:type="integer">131</partition_id> 
      <persistent_superblock  config:type="boolean">true</persistent_superblock>                 
      <mount>/space</mount>
      <raid_type>raid1</raid_type>
    </raid_device>
  </raid>
  
	    

Using the new method, the above configuration has the following syntax:

Example 4.18. RAID1 configuration (New Syntax)


  <partitioning config:type="list">
    <drive>
      <device>/dev/sda</device>
      <partitions config:type="list">
	<partition>
	  <partition_id config:type="integer">253</partition_id>
	  <format config:type="boolean">false</format>
	  <raid_name>/dev/md0</raid_name>
	  <raid_type>raid</raid_type>
	  <size>4gb</size>            
	</partition>

	<!-- Here come the regular partitions, i.e. / and swap -->        
      </partitions>
      <use>all</use>
    </drive>
    <drive>
      <device>/dev/sdb</device>
      
      <partitions config:type="list">
	<partition>
	  <format config:type="boolean">false</format>
	  <partition_id config:type="integer">253</partition_id>	  
	  <raid_name>/dev/md0</raid_name>            
	  <raid_type>raid</raid_type>
	  <size>4gb</size>
	</partition>
      </partitions>
      <use>all</use>
    </drive>
    <drive>
      <device>/dev/md</device>
      <partitions config:type="list">
	<partition>
	  <filesystem config:type="symbol">reiser</filesystem>
	  <format config:type="boolean">true</format>
	  <mount>/space</mount>
	  <partition_id config:type="integer">131</partition_id>	 
	  <partition_nr config:type="integer">0</partition_nr>
	  <raid_options>
	    <chunk_size>4</chunk_size>
	    <parity_algorithm>left-asymmetric</parity_algorithm>	   
	    <raid_type>raid1</raid_type>
	  </raid_options>
	 	  
	</partition>
      </partitions>
      <use>all</use>
    </drive>
    
  </partitioning>

	    

The following has to be taken into consideration when configuring raid using the new syntax:

  • The device for raid is always /dev/md

  • The property partition_nr is used to determine the MD device number. if partition_nr is equal to 0, then /dev/md0 is configured.

  • All RAID specific options are contained in the raid_options resource.