CentOSが新しいパーティションを追加してマウントを設定

6990 ワード

環境バージョン:CentOS 6.5
[root@localhost ~]# lsblk
NAME                        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                           8:0    0  1000G  0 disk 
├─sda1                        8:1    0   500M  0 part /boot
└─sda2                        8:2    0 199.5G  0 part 
  ├─VolGroup-lv_root (dm-0) 253:0    0    50G  0 lvm  /
  ├─VolGroup-lv_swap (dm-1) 253:1    0   3.9G  0 lvm  [SWAP]
  └─VolGroup-lv_home (dm-2) 253:2    0 145.6G  0 lvm  /home
sr0                          11:0    1   4.2G  0 rom  /media/CentOS_6.5_Final
[root@localhost ~]# fdisk /dev/sda

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): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   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
   x   extra functionality (experts only)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (26109-130541, default 26109): 
Using default value 26109
Last cylinder, +cylinders or +size{K,M,G} (26109-130541, default 130541): 
Using default value 130541

Command (m for help): p

Disk /dev/sda: 1073.7 GB, 1073741824000 bytes
255 heads, 63 sectors/track, 130541 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005fd30

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64       26109   209202176   8e  Linux LVM
/dev/sda3           26109      130541   838855382+  83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16:       .
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@localhost ~]# lsblk
NAME                        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                           8:0    0  1000G  0 disk 
├─sda1                        8:1    0   500M  0 part /boot
└─sda2                        8:2    0 199.5G  0 part 
  ├─VolGroup-lv_root (dm-0) 253:0    0    50G  0 lvm  /
  ├─VolGroup-lv_swap (dm-1) 253:1    0   3.9G  0 lvm  [SWAP]
  └─VolGroup-lv_home (dm-2) 253:2    0 145.6G  0 lvm  /home
sr0                          11:0    1   4.2G  0 rom  /media/CentOS_6.5_Final
[root@localhost ~]# vim /etc/fstab 
#
# /etc/fstab
# Created by anaconda on Tue May 29 14:38:18 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/VolGroup-lv_root /                       ext4    defaults        1 1
UUID=8201d284-b00b-44c9-ba6f-468c40590d6f /boot                   ext4    defaults        1 2
/dev/mapper/VolGroup-lv_home /home                   ext4    defaults        1 2
/dev/mapper/VolGroup-lv_swap swap                    swap    defaults        0 0
#       
/dev/sda3               /data                   ext4    defaults        1 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

[root@localhost ~]# reboot

Broadcast message from [email protected]
	(/dev/pts/0) at 13:46 ...

The system is going down for reboot NOW!
[root@localhost ~]# 
Connection closed by foreign host.

Disconnected from remote host(XXX-HDP2-3.18) at 14:23:38.

Type `help' to learn how to use Xshell prompt.
[c:\~]$ 

Connecting to XXX.3.18:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Last login: Wed Jul 24 13:40:05 2019 from XXX.67
[root@localhost ~]# lsblk
NAME                        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                           8:0    0  1000G  0 disk 
├─sda1                        8:1    0   500M  0 part /boot
├─sda2                        8:2    0 199.5G  0 part 
│ ├─VolGroup-lv_root (dm-0) 253:0    0    50G  0 lvm  /
│ ├─VolGroup-lv_swap (dm-1) 253:1    0   3.9G  0 lvm  [SWAP]
│ └─VolGroup-lv_home (dm-2) 253:2    0 145.6G  0 lvm  /home
└─sda3                        8:3    0   800G  0 part 
sr0                          11:0    1   4.2G  0 rom  
[root@localhost ~]# mkdir /data
[root@localhost ~]# mkfs.ext4 /dev/sda3
mke2fs 1.41.12 (17-May-2010)
      =
    :Linux
   =4096 (log=2)
    =4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
52428800 inodes, 209713845 blocks
10485692 blocks (5.00%) reserved for the super user
      =0
Maximum filesystem blocks=4294967296
6400 block groups
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, 71663616, 78675968, 
	102400000

    inode :                               
Creating journal (32768 blocks):   
Writing superblocks and filesystem accounting information:   

This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@localhost ~]# mount -t ext4 /dev/sda3 /data
[root@localhost ~]# df -h
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root   50G  3.4G   44G   8% /
tmpfs                          32G   72K   32G   1% /dev/shm
/dev/sda1                     485M   39M  421M   9% /boot
/dev/mapper/VolGroup-lv_home  144G  189M  136G   1% /home
/dev/sda3                     788G  197M  748G   1% /data
[root@localhost ~]# lsblk
NAME                        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                           8:0    0  1000G  0 disk 
├─sda1                        8:1    0   500M  0 part /boot
├─sda2                        8:2    0 199.5G  0 part 
│ ├─VolGroup-lv_root (dm-0) 253:0    0    50G  0 lvm  /
│ ├─VolGroup-lv_swap (dm-1) 253:1    0   3.9G  0 lvm  [SWAP]
│ └─VolGroup-lv_home (dm-2) 253:2    0 145.6G  0 lvm  /home
└─sda3                        8:3    0   800G  0 part /data
sr0                          11:0    1   4.2G  0 rom