List Partitions
The fdisk -l commands lists the partitions on your system.
# fdisk -l /dev/sda
Disk /dev/sdb: 536.9 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x93e0e5c0
Device Boot Start End Blocks Id System
Disk /dev/sda: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00063dc9
Device Boot Start End Blocks Id System
/
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 6528 51915776 8e Linux LVM
Disk /dev/dm-1 doesn't contain a valid partition table
Entering Command Mode
To work on a disk’s partitions , you have to enter command mode. You’ll need the device name of a disk from the fdisk -l command. The following command enters command mode for the first disk device:
a. fdisk /dev/sdb
Using Command Mode
In command mode, you use single-letter commands to specify actions you want to take. Type m and press Enter to see a list of the commands you can use.
Viewing the Partition Table
Use p to print the current partition table to the terminal from within command mode.
Deleting a Partition
Use the d command to delete a partition. You’ll be asked for the number of the partition you want to delete, which you can get from the p command. For example, if I wanted to delete the partition at /dev/sda5, I’d type 5.
After deleting the partition, you can type p again to view the current partition table. The partition appears deleted, but fdisk doesn’t write these changes to disk until you use the w command.
Creating a Partition
Use the n command to create a new partition. You can create a logical or primary partition (l for logical or p for primary). A disk can only have four primary partitions.
Next, specify the sector of the disk you want the partition to start at. Press Enter to accept the default sector, which is the first free sector on the disk.
Last, specify the last sector of the partition on the disk. If you want to use up all available space after the initial sector, just press Enter. You can also specify a specific size, such as +5G for a five gigabyte partition or +512M for a 512 megabyte partition. If you don’t specify a unit after the + sign, fdisk uses sectors as the unit. For example, +10000 results in the end of the partition being 10000 sectors after its beginning.
Writing Changes
Use w to write the changes you’ve made to disk.
Use q if you want to quit without saving changes.
Formatting a Partition
You must format new partitions with a file system before you can use them. You can do this with the appropriate mkfs command. For example, this command formats the fifth partition on the first disk with the ext4 file system.
mkfs . ext4 /dev/sdb1
To Mount
# mkdir /u01
To Auto mount everytime system reboots
#
/dev /sdb1 /u01 ext3 defaults 1 2
/dev /sdb2 /u02 ext3 defaults 1 2
To check which format
http://computernetworkingnotes.com/file-system-administration/how-to-create-swap-partition.html
No comments:
Post a Comment