To view the system's available disk size:
[Email protected] ~]# df-h
Filesystem Size used Avail use% mounted on
/DEV/SDA1 20G 7.3G 12G 39%/
Tmpfs 32G 72K 32G 1%/DEV/SHM
To view the available disks for a server:
[Email protected] ~]# fdisk-l
disk/dev/sdb:8589 MB, 8589934592 bytes
Heads, Sectors/track, 8192 cylinders
Units = Cylinders of 2048 * 1048576 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000
disk/dev/sda:21.5 GB, 21474836480 bytes
255 heads, Sectors/track, 2610 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00026e4e
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 2611 20970496 Linux
disk/dev/sdc:53.7 GB, 53687091200 bytes
Heads, Sectors/track, 51200 cylinders
Units = Cylinders of 2048 * 1048576 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000
Format disk/DEV/SDC:
[Email protected] ~]# FDISK/DEV/SDC
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF Disklabel
Building a new DOS disklabel with disk identifier 0xfb75b574.
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 Assist): M--View Help
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--Add a new partition
Command Action
E Extended
P primary partition (1-4)
P-----Primary Partition
Partition number (1-4): 1----partition No. 1
First cylinder (1-51200, default 1):---defaults from 1
Using Default value 1
Last cylinder, +cylinders or +size{k,m,g} (1-51200, default 51200):--Default 51200 end
Using Default Value 51200
Command (M for help): W---Error on the above changes to disk
The partition table has been altered!
Calling IOCTL () to re-read partition table.
Syncing disks.
format to the appropriate file system type:
To view system disk partitions:
[Email protected] ~]# fdisk-l
disk/dev/sdb:8589 MB, 8589934592 bytes
Heads, Sectors/track, 8192 cylinders
Units = Cylinders of 2048 * 1048576 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000
disk/dev/sda:21.5 GB, 21474836480 bytes
255 heads, Sectors/track, 2610 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00026e4e
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 2611 20970496 Linux
disk/dev/sdc:53.7 GB, 53687091200 bytes
Heads, Sectors/track, 51200 cylinders
Units = Cylinders of 2048 * 1048576 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0xfb75b574
Device Boot Start End Blocks Id System
/DEV/SDC1 1 51200 52428784 Linux
To format a specific mount partition:
[Email protected] ~]# MKFS.EXT4/DEV/SDC1
MKE2FS 1.41.12 (17-may-2010)
Discarding device Blocks:done
Filesystem label=
OS Type:linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
3276800 inodes, 13107196 blocks
655359 blocks (5.00%) reserved for the Super user
First Data block=0
Maximum filesystem blocks=4294967296
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
Writing Inode Tables:done
Creating Journal (32768 blocks): Done
Writing Superblocks and FileSystem accounting Information:--Enter by default
Done
This filesystem would be automatically checked every mounts or
Whichever comes first. Use Tune2fs-c or-i to override.
To create a mounted disk directory:
[Email protected] ~]# Mkdir/data
Mount/DEV/SDC1 to directory/data:
[Email protected] ~]# Mount/dev/sdc1/data
[Email protected] ~]# df-h
Filesystem Size used Avail use% mounted on
/DEV/SDA1 20G 7.3G 12G 39%/
Tmpfs 32G 72K 32G 1%/DEV/SHM
/DEV/SDC1 50G 180M 47G 1%/data
To set up a Linux system boot automatically mount disk:
1) View the disk UUID
[Email protected] ~]# BLKID/DEV/SDC1
/dev/sdc1:uuid= "0c43e879-0e8b-4633-aa7b-d3c5a0e10614" type= "Ext4"
2) Write/etc/fstab file: Add the last line of information, save exit.
[Email protected] ~]# Vim/etc/fstab
#
#/etc/fstab
# Created by Anaconda on Sat June 21 09:11:21 2014
#
# 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=261E0E16-2332-4716-9AF4-0D0449A53C92/EXT4 Defaults 1 1
Label=yunifyswap 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
Uuid=0c43e879-0e8b-4633-aa7b-d3c5a0e10614/data EXT4 Defaults 0 2
Linux Loading HDD process