Linux new disk mount and restart auto mount

Source: Internet
Author: User
Tags uuid

Tips for two points:
* The newly added hard drive needs to restart the server fdisk-l to see
* To use the root account for the following operations
That's about it. View-partition-format-mount-restart auto mount
1. Restart the server after adding the hard drive to view
[Email protected] ~]# fdisk-l

disk/dev/sdb:214.7 GB, 214748364800 bytes
255 heads, Sectors/track, 26108 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000

Disk/dev/sdb doesn ' t contain a valid partition table

disk/dev/sda:85.9 GB, 85899345920 bytes
255 heads, Sectors/track, 10443 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x000cd039

Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 204800 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 536 4096000 Swap/solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3 536 10444 79584256-up Linux
2. Partitioning
Fdisk can use the M command to see the internal commands of the FDISK command;
A: The command specifies the boot partition;
D: command to delete an existing partition;
L: command displays a list of partition ID numbers;
M: View the fdisk command help;
N: command to create a new partition;
P: command displays a list of partitions;
T: Command modifies the type ID number of the partition;
W: The command is to save changes to the partition table to make it work.

[Email protected] ~]# fdisk/dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF Disklabel
Building a new DOS disklabel with disk identifier 0x515ae162.
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 ') and change display units to
Sectors (Command ' u ').

Command (M for help): n
Command Action
E extended//Enter E to create an extended partition
P primary partition (1-4)// input P to create logical partition
P
Partition number (1-4): 1 // Enter the L hereand enter the logical partitioning phase
First cylinder (1-26108, default 1)://Note: This is the start value of the partition, it is best to press ENTER directly , if you enter a non-default number, will cause space waste;
Using Default value 1
Last cylinder, +cylinders or +size{k,m,g} (1-26108, default 26108): I'll go straight to the full use. Note: This is the definition of partition size, +200m is the size of 200M, of course, you can also be based on the P hint of the unit cylinder size to calculate, and then to specify the value of end. Look back to see how it is, or use +200m this method to add, this can be intuitive. If you want to add a 10G or so size partition, please enter +10000m;
Using Default Value 26108

Command (M for help): w// Last input W enter save .
The partition table has been altered!

Calling IOCTL () to re-read partition table.
Syncing disks.
After saving, check
[Email protected] ~]# fdisk-l

disk/dev/sdb:214.7 GB, 214748364800 bytes
255 heads, Sectors/track, 26108 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x515ae162

Device Boot Start End Blocks Id System
/DEV/SDB1 1 26108 209712478+ Linux

disk/dev/sda:85.9 GB, 85899345920 bytes
255 heads, Sectors/track, 10443 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x000cd039

Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 204800 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 536 4096000 Swap/solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3 536 10444 79584256-up Linux
3. Formatting
[Email protected] ~]#MKFS.EXT3/DEV/SDB1Note: The/DEV/SDB1 format as a ext3 type, confirm that I/dev/sdb1 above is a new 200GB hard drive, this step directly to the return, format will automatically jump out of
MKE2FS 1.41.12 (17-may-2010)
Filesystem label=
OS Type:linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
13107200 inodes, 52428119 blocks
2621405 blocks (5.00%) reserved for the Super user
First Data block=0
Maximum filesystem blocks=4294967296
Groups block
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872

Writing Inode Tables:done
Creating Journal (32768 blocks): Done
Writing superblocks and filesystem accounting Information:done

This filesystem'll be automatically checked every mounts or
Whichever comes first. Use Tune2fs-c or-i to override.
4. Mounting
--Create a directory, then mount it to the directory
[Email protected] ~]#Mkdir/data
[Email protected] ~]#Mount/dev/sdb1/data
[Email protected] ~]# df-h
Filesystem Size used Avail use% mounted on
/dev/sda3 75G 21G 51G 29%/
Tmpfs 3.9G 0 3.9G 0%/dev/shm
/DEV/SDA1 194M 25M 160M 14%/boot
/DEV/SDB1 197G 188M 187G 1%/data
5, restart the boot automatically mount, to write to fstab inside (that is the last line), or restart after the new home to find the hard drive
[Email protected] ~]#Vi/etc/fstab
#
#/etc/fstab
# Created by Anaconda on Tue APR 16 01:33:57 2013
#
# Accessible filesystems, by reference, is maintained under '/dev/disk '
# See mans Pages Fstab (5), Findfs (8), mount (8) and/or Blkid (8) for more info
#
UUID=F87D8E1F-9A62-4CB8-93A8-A4793465EB23/EXT4 Defaults 1 1
Uuid=cdb27acf-3bbb-4f03-b20c-cfbc9d8450b9/boot EXT4 Defaults 1 2
UUID=63399012-86B0-43E7-8CEE-A0ACE153DD7E swap swap defaults 0 0
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 proc Defaults 0 0
/dev/sdb1/data ext3 defaults 0 0
This ok!

Linux new disk mount and restart auto mount

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.