Ubuntu-hard disk partitioning, formatting, automatic mount configuration _ubuntu

Source: Internet
Author: User
Tags uuid what file system

Reproduced from: http://www.cnblogs.com/hnrainll/archive/2012/02/27/2369331.html

The hard disk space is not enough, need to increase the new hard disk expansion. Write down the entire process of partitioning, formatting, and mounting the configuration automatically.

Operating Environment | Enviroment

Ubuntu 10.10

One, hard disk partition | Hard disk Add new partition

1, display the hard disk and the partition. Enter the following command in the terminal window: sudo fdisk-lu


Displays the current hard drive and the partition to which it belongs. As shown in the following illustration:
System hint: Disk/dev/sdb doesn ' t contain a valid partition table.



2, partition the hard disk. Enter the following command in the terminal window: sudo fdisk/dev/sdb


As shown in the following illustration:
Enter M to display a Help menu after the command (m for help) prompt.


Enter n after the command (m for help) prompt to add a new partition to the hard drive by executing the partition directive.
When the command action appears, enter E, specifying the partition as an extended partition (extended).
When partition number (1-4) appears, input 1 indicates that only one area is divided.
The following specifies the starting cylinder (cylinder) number to complete the partition.

&NBSP

Displays the partition table by entering p after the command (m for help) prompt.
The system prompts as follows:
Device boot                  start                End                    blocks          id              System
/dev/sdb1                            1             26108            209712478+           5           Extended



Enter W after the command (m for help) prompt to save the partition table.
System hint: the partition table has been altered!


Enter the following command in the terminal window:
sudo fdisk-lu

As shown in the following illustration:
The system has identified the partitions of the hard disk/dev/sdb.


Second, hard disk format | Format hard Disk 1, display the hard drive and the partition to which it belongs. Enter the following command in the terminal window:
sudo mkfs-t ext4/dev/sdb
Description
-T EXT4 represents the format of the partition as a EXT4 file system type.


Note: After the format is completed, the system has the following prompts:
This filesystem would be automatically checked every mounts or
180 days, whichever comes. Use Tune2fs-c or-i to override.
For the system to ensure the integrity of the file system, each load 28 times or every 180 days to fully check the file system, you can use the command tune2fs-c or tune2fs-i to adjust the default values.


Third, mounted hard disk partition | Mount hard disk partition 1, display the hard drive mount condition. Enter the following command in the terminal window:
sudo df-l
The new hard drive partition is not mounted and cannot be entered and viewed.

Enter the following command in the terminal window:
sudo mount-t ext4/dev/sdb/devdata
Description
Specifies that the hard disk partition file system type is EXT4 while the/DEV/SDB partition is mounted to the directory/devdata.

Enter the following command again in the terminal window:
sudo df-l

The new hard drive partition is already mounted, as shown in the red box below.


2. Configure the hard drive to mount automatically when the system starts. Add the following configuration to the file/etc/fstab:
#/devdata was On/dev/sdb
Uuid=37eaa526-5d96-4237-8468-603df5216ce9/devdata EXT4 Defaults 0 3




Appendix 1:fdisk Order Detailed | The syntax for the Appendix Part 1:fdisk command Syntax fdisk command is as follows:
fdisk [-B sectorsize] Device

Fdisk-l [-u] [device ...]

Fdisk-s partition ...

Fdisk-v
Description
-B <sectorsize> Specify the size of each partition. You can also perform an FDISK device (such as: FDISK/DEV/SDB) and specify it when prompted. -l lists the partition table status of the specified peripherals. If you are only performing fdisk-l, the system lists known partitions. -U with the "-l" argument list, the number of partitions is replaced by the number of columns to represent the starting address for each partition. -S <parttion> outputs the specified partition size to the standard output, in blocks. -V Displays the version information for Fdisk.

Appendix 2:mkfs Order Detailed | The syntax for the Appendix Part 2:MKFS command Syntax MKFS commands is as follows:
MKFS [-v] [-t fstype] [fs-options] Filesys
Description
-V Displays a brief method of use. -T <fstype> specifies what file system to build, such as: Ext3, Ext4. FS Specifies the parameters when the file system is established. -V Displays version information and details how to use it.

Appendix 3:mount Order Detailed | The syntax for the Appendix Part 3:mount command Syntax MKFS commands is as follows:
Mount [-AFFNRSVW] [-t vfstype] [-l label] [-O options] Device dir

Mount [-LHV]

Description
-A loads all devices set in the file/etc/fstab. -F does not physically load the device. Can be used at the same time as-V to view the execution of the mount. -F must be used with the-a parameter. All devices set in/etc/fstab are loaded at the same time to speed up execution. -T vfstype specifies the loaded file system type, such as: Ext3, Ext4. -L label specifies a label name for the mount point. -L Displays the partition's label. -h Displays help information. -V Displays the version information for the mount. Device the partition or file to be mounted. If device is a file, the-o loop parameter must be added when mounting. The mount point of the Dir partition.

Appendix 4:fstab Configuration Detailed | Appendix Part 4:fstab Detail Configuration/etc/fstab A total of 6 columns:
File system: Specifies the device name (for example,/dev/sdb) of the filesystem to be mounted. You can also use Uuid,uuid to specify the device's UUID number by using the Blkid command to view (such as: BLKID/DEV/SDB). Mount point: Mount points. is to manually create a directory of your own and then mount the partition to this directory. Type: Used to specify the file system types. such as: Ext3, EXT4, NTFS and so on. Option dump:0 indicates no backup, 1 means that you want to back up content in the entire <file system>. It is recommended here to set to 0. Pass: Specifies how fsck will check the hard drive. 0 means no check, mount point is partition/(root partition) must be set to 1, the other mount points cannot be set to 1, and if the Mount ass is set to a value greater than 1, check the same value at the same time, after the root partition is checked, and then the value of Pass is checked from small to large. such as:/home and/boot Pass set to 2,/devdata pass set to 3, then the system after checking the root partition, and then check/boot and/home, and then check the/devdata.


< body end >

Turn from: http://aofengblog.blog.163.com/blog/static/6317021201101502540117/

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.