Ubuntu-hard disk partitioning, formatting, automatic mount configuration

Source: Internet
Author: User
Tags what file system

Ubuntu system hard disk space is not enough, need to add new HDD expansion. Write down the entire process of partitioning, formatting, and automatic mounting of the hard disk.

Operating Environment | Enviroment

Ubuntu 10.10

One, hard disk partition | Hard disk Add new partition

1, display the hard disk and its own partition situation. Enter the following command in the terminal window:

sudo fdisk-lu


Displays the current hard disk and the owning partition. As shown in the following:
System tip: 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:
Enter M after the command (m for help) prompt to display a helper menu.

After entering N at the command (m for help) prompt, execute the Add a new partition instruction to add another partition to the hard disk.
When the command action appears, enter E, specifying that the partition is an extended partition (extended).
When partition number (1-4) appears, input 1 indicates that only one area is divided.
The subsequent specified starting cylinder face (cylinder) number completes the partition.

 

Enter p after the command (m for help) prompt to display the partition table. The
system prompts you 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!


In the terminal window, the output intoAs the following command:
sudo fdisk-lu
As shown in the following:
The system has identified the partition of the hard disk/dev/sdb.


Second, hard disk format | Format hard Disk1, displays the drive and the partition it belongs to. Enter the following command in the terminal window:
sudo mkfs-t ext4/dev/sdb Description:
-T EXT4 indicates that the partition is formatted as a EXT4 file system type.


Note: After formatting is complete, the system has the following prompts:
This filesystem would be automatically checked every mounts or
Whichever comes first. Use Tune2fs-c or-i to override.
Indicates that in order to ensure the integrity of the file system, the file system should be fully inspected every 28 times or every 180 days, and the default values can be adjusted using command tune2fs-c or tune2fs-i.


Three, mount hard disk partition | Mount hard disk Partition1, displays the drive mount condition. Enter the following command in the terminal window:
sudo df-l new hard disk partition is not mounted and cannot be accessed 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 disk partition is already mounted, such as the bottom red box content.


2. Configure the hard drive to automatically mount on the system boot. 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 Command Explanation | The syntax for Appendix Part 1:fdisk Command Syntaxfdisk commands 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 execute FDISK device (such as: FDISK/DEV/SDB) After you specify it when prompted.
    • -l lists the partition table status for the specified peripheral device. If only fdisk-l is executed, the system lists the known partitions.
    • -U is paired with the "-L" parameter list, which replaces the number of cylinders with the number of partitions to represent the starting address of each partition.
    • -S <parttion> outputs the size of the specified partition to the standard output, in chunks.
    • -V Displays the version information for Fdisk.


Appendix 2:MKFS Command Explanation | The syntax for Appendix Part 2:MKFS Command SYNTAXMKFS commands is as follows:
Mkfs [-v] [-t fstype] [fs-options] Filesys
Description
    • -V shows a brief use of the method.
    • -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 with detailed usage methods.


Appendix 3:mount Command Explanation | The syntax for Appendix Part 3:mount Command SYNTAXMKFS commands is as follows:
Mount [-AFFNRSVW] [-t Vfstype] [-l label] [-O options] Device dir

Mount [-LHV]

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


Appendix 4:fstab Configuration Detailed | Appendix Part 4:fstab Detail Configuration/etc/fstab in 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 (for example, Blkid/dev/sdb).
    • Mount point: Mount points. is to manually create a directory, and then mount the partition to this directory.
    • Type: Used to specify the types of file systems. such as: Ext3, EXT4, NTFS and so on.
    • Option dump:0 means no backup, and 1 means that you want to back up the contents of the entire <file system>. The recommended setting here is 0.
    • Pass: Used to specify how fsck will check the hard disk. 0 means no check, the mount point is partition/(root partition) must be set to 1, the other mount point cannot be set to 1, if there is a mount that is set to a value greater than 1, then after the root partition is checked, and then the value of the pass is checked from small to large, the same value is checked at the same time. such as:/home and/boot pass set to 2,/devdata pass set to 3, then the system checks the root partition, and then check the boot and/home, and then check the/devdata.

Ubuntu-hard disk partitioning, formatting, automatic mount configuration

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.