CONTENT
  • CHANGES
Szukaj
counter

#top sfdisk


sfdisk - Partition table manipulator for Linux

Powiązane:
parted, sfdisk,

SYNOPSIS
sfdisk [options] device
sfdisk -s [partition]


DESCRIPTION



OPTIONS
-v or --version
Print version number of sfdisk and exit immediately.

-? or --help
Print a usage message and exit immediately.

-T or --list-types
Print the recognized types (system Id's).

-s or --show-size
List the size of a partition.

-g or --show-geometry
List the kernel's idea of the geometry of the indicated disk(s).

-G or --show-pt-geometry
List the geometry of the indicated disks guessed by looking at the partition table.

-l or --list
List the partitions of a device.

-d
Dump the partitions of a device in a format useful as input to sfdisk. For example,
% sfdisk -d /dev/hda > hda.out
% sfdisk /dev/hda < hda.out
will correct the bad last extended partition that the OS/2 fdisk creates.

-V or --verify
Test whether partitions seem correct. (See above.)

-i or --increment
Number cylinders etc. starting from 1 instead of 0.

-N number
Change only the single partition indicated. For example:
% sfdisk /dev/hdb -N5
,,,*
%
will make the fifth partition on /dev/hdb bootable ('active') and change nothing else. (Probably this fifth partition is called /dev/hdb5, but you are free to call it something else, like '/my_equipment/disks/2/5' or so).

-Anumber
Make the indicated partition(s) active, and all others inactive.

-c or --id number [Id]
If no Id argument given: print the partition Id of the indicated partition. If an Id argument is present: change the type (Id) of the indicated partition to the given value. This option has the two very long forms --print-id and --change-id. For example:
% sfdisk --print-id /dev/hdb 5
6
% sfdisk --change-id /dev/hdb 5 83
OK
first reports that /dev/hdb5 has Id 6, and then changes that into 83.

-uS or -uB or -uC or -uM
Accept or report in units of sectors (blocks, cylinders, megabytes, respectively). The default is cylinders, at least when the geometry is known.

-x or --show-extended
Also list non-primary extended partitions on output, and expect descriptors for them on input.

-C cylinders
Specify the number of cylinders, possibly overriding what the kernel thinks.

-H heads
Specify the number of heads, possibly overriding what the kernel thinks.

-S sectors
Specify the number of sectors, possibly overriding what the kernel thinks.

-f or --force
Do what I say, even if it is stupid.

-q or --quiet
Suppress warning messages.

-L or --Linux
Do not complain about things irrelevant for Linux.

-D or --DOS
For DOS-compatibility: waste a little space. (More precisely: if a partition cannot contain sector 0, e.g. because that is the MBR of the device, or contains the partition table of an extended partition, then sfdisk would make it start the next sector. However, when this option is given it skips to the start of the next track, wasting for example 33 sectors (in case of 34 sectors/track), just like certain versions of DOS do.) Certain Disk Managers and boot loaders (such as OSBS, but not LILO or the OS/2 Boot Manager) also live in this empty space, so maybe you want this option if you use one.

-E or --DOS-extended
Take the starting sector numbers of "inner" extended partitions to be relative to the starting cylinder boundary of the outer one, (like some versions of DOS do) rather than to the starting sector (like Linux does). (The fact that there is a difference here means that one should always let extended partitions start at cylinder boundaries if DOS and Linux should interpret the partition table in the same way. Of course one can only know where cylinder boundaries are when one knows what geometry DOS will use for this disk.)

--IBM or --leave-last
Certain IBM diagnostic programs assume that they can use the last cylinder on a disk for disk-testing purposes. If you think you might ever run such programs, use this option to tell sfdisk that it should not allocate the last cylinder. Sometimes the last cylinder contains a bad sector table.

-n
Go through all the motions, but do not actually write to disk.

-R
Only execute the BLKRRPART ioctl (to make the kernel re-read the partition table). This can be useful for checking in advance that the final BLKRRPART will be successful, and also when you changed the partition table 'by hand' (e.g., using dd from a backup). If the kernel complains ('device busy for revalidation (usage = 2)') then something still uses the device, and you still have to unmount some file system, or say swapoff to some swap partition.

--no-reread
When starting a repartitioning of a disk, sfdisk checks that this disk is not mounted, or in use as a swap device, and refuses to continue if it is. This option suppresses the test. (On the other hand, the -f option would force sfdisk to continue even when this test fails.)

-O file
Just before writing the new partition, output the sectors that are going to be overwritten to file (where hopefully file resides on another disk, or on a floppy).

-I file
After destroying your filesystems with an unfortunate sfdisk command, you would have been able to restore the old situation if only you had preserved it using the -O flag.



EXAMPLES
# create partition structure
sfdisk /dev/sda <<EOF
,950,83
,,82
EOF

klonowanie tablicy partycji
sfdisk -d /dev/hda > fdisk.hda
sfdisk /dev/hdb < fdisk.hda
sfdisk -d /dev/hda | sfdisk  /dev/hdb




Zmodyfikowany ostatnio: 2014/05/15 15:05:55 (9 lat temu), textsize: 7,36 kB, htmlsize: 8,47 kB

Zapraszam do komentowania, zgłaszania sugestii, propozycji, własnych przykładów, ...
Dodaj komentarzKomentarze użytkowników