Linux disk partitioning, formatting, directory mounts

Source: Internet
Author: User

1. Display the current host directory

Commanddf -h

 [[email protected] ~]# df-hfilesystem Size used Avail use% mounted on/dev/mapper/volgroup-lv_root 26g 2.9G 22g 13%/tmpfs 1.9g 0  1.9g 0%/dev/shm/dev/xvda1 485< Span class= "Hljs-keyword" >m 32m  428m 7%/boot        
2. Disk partition 2.1 shows the current disk of the machine:

Commandfdisk -l

[[email protected] ~]# fdisk -l /dev/xvdb Disk /dev/xvdb: 53.7 GB, 53687091200 bytes255 heads, 63 sectors/track, 6527 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000

Note: It is known here that the new disk is/dev/xvdb, and it is directly specified, reducing the length of the display.

2.2 FDISK partition/DEV/XVDB:

fdisk /dev/xvdbAccording to the Help Tips section, this is to divide/dev/xvdb into a zone.

[Email protected] ~]# Fdisk/dev/xvdbdevice contains neither a valid DOS partition table, nor Sun, SGI or OSF Disklabelbu Ilding a new DOS disklabel with disk identifier 0x0adfd119. Changes'll remain in memory only, until the decide to write them. After that, of course, the previous content won ' t is recoverable. Warning:invalid flag 0x0000 of partition Table 4 would be a corrected by W (rite) warning:dos-compatible mode is deprecated. It ' s strongly recommended to switch off the mode (command ' C ') andChange display unitsTo Sectors (command' U '). Command (MForHelp):McommandAction A toggle a bootable flag B edit BSD DisklabelC Toggle the DOSCompatibility flagDDelete aPartitionLList knownPartition typesM Print this menuNAdd aNewPartition OCreate aNewEmpty DOSPartitionTableP Print thePartitionTable Q quitWithout saving changes SCreate aNewEmpty Sun DisklabelTchange a partition ' s system ID u Change Display/entry units v Verify the partition Table W write table to disk and exit X extra functionality (experts only ) Command (M for help): Ncommand action E Extended P primary partition (1-4) ppartition number (1-4): 1First Cylinder (1-652 7, default 1): Using default value 1Last cylinder, +cylinders or +size{k,m,g} (1-6527, default 6527): Using default value 6527Command (M for help): pdisk/dev/xvdb:53.7 GB, 53687091200 bytes255 heads, sectors/track, 6527 cylindersunits = cy Linders of 16065 * 8225280 = bytessector size (logical/physical): bytes/512 bytesi/o size (minimum/optimal): 512 bytes/512 bytesdisk identifier:0x0adfd119 Device Boot Start End Blocks Id system/dev/xvdb1 1 6527 52428096-linuxcom Mand (M for help): Wthe partition table have been altered! Calling IOCTL () to re-read partition table. Syncing disks.   
3. Disk formatting

mkfs.ext4 /dev/xvdb1the command partition is a EXT4 file system format.

[Email protected] ~]# MKFS.EXT4/DEV/XVDB1 MKE2FS1.41.12 (17-may-2010) Filesystem Label=osTypeLinuxblock size=4096 (log=2) Fragment size=4096 (log=2) stride=0 blocks, Stripe width=0 Blocks3276800 Inodes,13107024 blocks655351 Blocks (5.00%) reservedFor the Super Userfirst data block=0Maximum filesystem blocks=4294967296Block groups32768 blocks per group,32768 fragments per group8192 inodes per groupsuperblock backups stored on blocks:32768,98304,163840,229376,294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424Writing inode Tables: Done Creating Journal (32768 blocks): donewriting superblocks and filesystem accounting Informa tion: donethis filesystem'll be automatically checked every -mounts orin days, whichever comes fi Rst. Use tune2fs-c or-i to override.            
4. Mount Directory 4.1 manual mount

New Catalog/u01mkdir -p /u01
Mount device to directory/u01mount /dev/xvdb1 /u01

[[email protected] ~]# mkdir -p /u01[[email protected] ~]# mount /dev/xvdb1 /u01
4.2 Boot Auto Mount

/etc/fstabto modify the configuration file, add a line at the end:

/dev/xvdb1              /u01                    ext4    defaults        0 0

Displays the current directory, successfully mounting the/U01 directory:

[Email protected] ~]# Df-hfilesystem Size used AvailUse% MountedOn/dev/mapper/volgroup-lv_root26G 2.9g  13%/tmpfs 1.9g 0 1.9G 0%/dev/shm/dev/xvda1 485M +m 428m 7%/boot/dev/xvdb1 G- m- g 1%/u01  

Reference article: http://www.cnblogs.com/jyzhao/p/4778657.html

Linux disk partitioning, formatting, directory mounts

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.