Partition tools in Linux

Source: Internet
Author: User
Linux partition tool [root @ localhostgxlinux] # df-Th # view the size and format of the mounted file partition (of course, your system must have free space) file system type capacity in use available % mount point/dev/sda1ext...
Linux partition tool [root @ localhost gxlinux] # df-Th # view the size and format of the mounted file partition (of course, your system must have free space) file system type capacity used available % mount point/dev/sda1 ext3 2.9G 2.2G 505 M 82% // dev/sda2 ext3 965 M 22 M 894 M 3%/hometmpfs tmpfs 345 M 12 K 345 M 1%/dev/shm [root @ localhost gxlinux] #/sbin/fdisk/dev/sda # fdisk command for disk partitioning # If you have a second hard disk, the device symbol is/dev/sdb, and The third is The number of cylinders for this disk is set to 1044. there is nothing wrong with that, but this is larger than 1024, and cocould in certain setups cause problems with: 1) software that runs at boot time (e.g ., old versions of LILO) 2) booting and partitioning software from other OSs (e.g ., dos fdisk, OS/2 FDISK) Command (m for help ): m # View fdisk Command help Command action www.2cto.com a toggle a bootable flag B edit bsd disklabel c toggle the dos compatibility flag d delete a partition # delete a partition l list known partition types m print this menu n add a new partition # add a new partition o create a new empty DOS partition table p print the partition table # print/view the partition table
Q quit without saving changes # Do not save exit s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit # save and exit x extra functionality (experts only) command (m for help): p # Print/view existing partition table www.2cto.com Disk/dev/sda: 8589 MB, 8589934592 bytes255 heads, 63 sectors/track, 1044 cylindersUnits = cylinders of 16065*512 = 8225280 bytesDisk identifier: 0x000e25d9 Device Boot Start End Blocks Id System/dev/sda1 * 1 382 3068383 + 83 Linux/dev/sda2 383 509 1020127 + 83 Linux/dev/sda3 510 636 1020127 + 82 Linux swap /SolarisCommand (m for help): n # Start to add a new partition Command action e extended # extended partition p primary partition (1-4) # primary partition, one hard disk can have four primary partitions # Example: in XP, drive C is the primary partition, and DEF is the logical partition (DEF is an extended partition)
E # Add extended partition www.2cto.com Selected partition 4 # partition 4 as the extended partition. partition 4 starts with First cylinder (637-1044, default 637 ): Using default value 637 # indicates the beginning of the partition. 1044 indicates the end of the block. Last cylinder or + size or + sizeM or + sizeK (637-1044, default 1044 ): # You can also enter the size of the partition you want to create here, for example, + 5000 MB, which indicates that the Using default value 1044 # Command (m for help) at the end of the partition is created ): n # create an extended partition and then create the logical partition First cylinder (637-1044, default 637 ): Using default value 637 Last cylinder or + size or + sizeM or + sizeK (637-1044, default 1044 ): Using default value 1044 Command (m for help): p # After the logical partition is created, print/View # you can see that a partition is added, logical partitions are Disk/dev/sda: 8589 MB, 8589934592 bytes255 heads, 63 sectors/track, 1044 cylindersUnits = cylinders of 16065*512 = 8225280 bytesDisk identifier: 0x000e25d9 Device Boot Start End Blocks Id System/dev/sda1 * 1 382 3068383 + 83 Linux/dev/sda2 383 509 1020127 + 83 Linux/dev/sda3 510 636 1020127 + 82 Linux swap/ Solaris/dev/sda4 637 1044 3277260 5 Extended/dev/sda5 637 1044 3277228 + 83 Linux www.2cto.com Command (m for help): w # write and save the new partition table, remember to save The partition table has been altered! Calling ioctl () to re-read partition table. WARNING: Re-reading the partition table failed with error 16: the device or resource is busy. the kernel still uses the old table. the new table will be used at the next reboot. syncing disks. [root @ localhost gxlinux] # df-Th # It is not mounted yet, therefore, the df command does not show that the new partition file system type capacity has been available % mount point/dev/sda1 ext3 2.9G 2.2G 505 M 82%/dev/sda2 ext3 965 M 22 M 894 M 3%/hometmpfs tmpfs 345 M 12 K 345 M 1%/dev/shm [root @ localhost gxlinux] #/sbin/mkfs. ext3/dev/sda5 # format before mounting, such as ext2, ext3 Format # You can also use/sbin/mkfs-t ext3/dev/sda5 # In fact, we have seen that the fdisk command has automatically formatted it as ext3 format mke2fs 1.40.2 (12-Jul-2007) warning: 107 blocks unused. filesystem label = OS type: LinuxBlock size = 4096 (log = 2) Fragment size = 4096 (log = 2) 410400 inodes, 819200 blocks40965 blocks (5.00%) reserved for the super userFirst data block = 0
Maximum filesystem blocks = 83886080025 block groups www.2cto.com 32768 blocks per group, 32768 fragments per group16416 inodes per groupSuperblock backups stored on blocks: 32768,983 04, 163840,229 376, 294912 Writing inode tables: done Creating journal (16384 blocks): doneWriting superblocks and filesystem accounting information: done This filesystem will be automatically checked every 35 mounts or180 days, whichever comes first. use tune2fs-c or-I to override. [root @ localhost gxlinux] #/sbin/e2label/dev/sda5 backup # Add a label to the new partition [root @ localhost gxlinux] # mkdir/mnt/bak # Create directory [root @ localhost gxlinux] # mount/dev/sda5/mnt/bak # mount the new partition to the specified directory [root @ localhost gxlinux] # df-Th # then you can see the mount file system type capacity used available % mount point/dev/sda1 ext3 2.9G 2.2G 505 M 82%/dev/sda2 ext3 965 M 22 M 894 M 3%/hometmpfs tmpfs 345 M 12 K 345 M 1%/dev/shm/dev/sda5 ext3 3.1G 69 M 2.9G 3%/mnt/bak www.2cto.com [root @ localhost gxlinux] # vim/etc/fstab # add a row to/etc/fstab to enable automatic mounting # you do not need to set it, the system can also be automatically mounted upon startup, because the format is the same as that in linux [root @ localhost gxlinux] # cat/etc/fstabLABEL = // ext3 defaults 1 1 LABEL =/home ext3 defaults 1 2 tmpfs/dev/shm tmpfs defaults 0 0 devpts/dev/pts devpts gid = 5, mode = 620 0 0 sysfs/sys sysfs defaults 0 0 proc/proc defaults 0 0 LABEL = SWAP-sda3 swap defaults 0 0 LABEL = backup/mnt/bak ext3 defaults 1 2
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.