summaryrefslogblamecommitdiffstats
path: root/disk-utils/sfdisk.8
blob: 4c75dc0d0cdd3cf834ed2cda448d326d016835b7 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13

                                                  
   









                                                                          
        
                                                      
            
         
               






               

               
                                                            
 
                  
         



                                                                             
 
         


                                                                         
 

                                       
         
                  
 

                                                                               
   


                                      
   
               
   

                               

   






                                                                                   
   


                             
   
                                
   


                                                                                           
   



                                                                                     
 

                                    
   




                                                                                   
   




                                                                                    
   

                                                                                 
   


                                                                                 
   

                                 
   


                                                                                 
   

                             
   

                                     
   

                                                                           
   

                                                                      
   


                                                                      
   

                           
   

                                     
 
              
              
               

                  






                                                                 
                

                                                                          
.\" sfdisk.8 -- man page for sfdisk
.\" Copyright (C) 2014 Karel Zak <kzak@redhat.com>
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.TH SFDISK 8 "September 2014" "util-linux" "System Administration"
.SH NAME
sfdisk \- display or manipulate a disk partition table
.SH SYNOPSIS
.B sfdisk
.RB [ options ]
.RI device
.BR [ \-N
.IR partno ]
.sp
.B sfdisk
.RB [ options ]
.RI command
.SH DESCRIPTION
.B sfdisk
is a script oriented tool for partitioning any block device.

Since version 2.25
.B sfdisk
supports MBR (DOS), GPT, SUN and SGI disk labels, but no longer provides any
functionality for CHS (Cylinder-Head-Sector) addressing.  CHS has
never been important for Linux, and this addressing concept does not make any
sense for new devices.

.B sfdisk
(since version 2.25) aligns start and end of the partitions to
block-device I/O limits when specified by relative sizes, or when default
values expected.

.SH "BACKUP PARTITION TABLE"
It's recommended to save device layout.
.B sfdisk
supports two ways.

Use \fB\-\-dump\fR command line option to save description of the device layout
to text file. The dump format is suitable for later sfdisk input. For example
.RS
.sp
.B "sfdisk --dump /dev/sda > sda.dump"
.sp
.RE
and restore by:
.RS
.sp
.B "sfdisk /dev/sda < sda.dump"
.RE

If you want to full (binary) backup of all sectors where is stored partition table 
then use \fB\-\-backup\fR command line option. It writes the sectors to 
~/sfdisk-<device>-<offset>.bak files. The default name of the backup file might
be changed by \fB\-\-backup\-file\fR command line option. The backup files
contain only raw data from the \fIdevice\fR. Note that the same concept of
backups files uses
.B wipefs (8)
.RS
.sp
.B "sfdisk --backup /dev/sda"
.sp
.RE
and later restore GPT header by:
.RS
.sp
.B dd if=~/sfdisk-sda-0x00000200.bak of=/dev/sda seek=$((0x00000200.bak)) bs=1 conv=notrunc
.sp
.RE
Note that sfdisk since version 2.25 does not provide \fB\-I\fR command line option to
restore sectors. 
.B dd (1)
provides all necessary functionality.

.SH COMMANDS
The commands are mutually exclusive.
.TP
.BR [\-N " \fIpartno\fR"] " " \fIdevice\fR
The default sfdisk command is to read the specification for the desired 
partitioning of \fIdevice\fR from standard input, and then create a partition
table according to the specification. See below description of the input
format. If the standard input is a terminal then sfdisk starts interactive session.
.TP
.BR \-a , " \-\-activate " \fIdevice\fR " "[\fIpartno\fR]
Switchs on the bootable flag. If \fIpartno\fR no specified then lists all partitions
with enabled flag.

.SH OPTIONS
.TP
.BR \-A , " \-\-append"
Don't create a new partition table, but rather appends specified partitions only.
.TP
.BR \-b , " \-\-backup"
Backup the current partition table sectors before start partitioning. The defautl
backup file name is ~/sfdisk-<device>-<offset>.bak, see \fI\-\-backup-file\fR.
.TP
.BR \-f , " \-\-force"
Disable all consistency checking.
.TP
.BR \-O , " \-\-backup-file " \fIpath\fR
Override default backup file name. Note that the device name and offset is always
appended to the file name.
.TP
.BR \-q , " \-\-quiet"
Suppress extra info messages.
.TP
.BR \-n , " \-\-no\-act"
Do everything except write to device.
.TP
.BR "\-\-no\-reread"
Do not check by re-read-partition-table ioctl whether the device is in use.
.TP
.BR \-u , " \-\-unit " S
Deprecated option. Specify input units, only sector unit is supported.
.TP
.BR "\-\-Linux"
Deprecated and ignored option. Linux (and another moder OS) compatible
partitioning is the default.
.TP
.BR \-h , " \-\-help"
Display help text and exit.
.TP
.BR \-V , " \-\-version"
Display version information and exit.

.SH "SEE ALSO"
.BR fdisk (8),
.BR cfdisk (8),
.BR parted (8),
.BR partprobe (8),
.BR partx(8)
.SH AUTHOR
Karel Zak <kzak@redhat.com>
.PP
The current sfdisk implementation is based on the original sfdisk
from Andries E. Brouwer.

.SH AVAILABILITY
The sfdisk command is part of the util-linux package and is available from
ftp://ftp.kernel.org/pub/linux/utils/util-linux/.