Home IT Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Linux disk management practices     - Linux, modify the hostname (Linux)

- Security basics: simple analytical framework for Linux system firewall (Linux)

- Kitematic how seamless and DockerFILE (Server)

- How VirtualBox and VMware virtual machine conversion (Linux)

- ORA-00845: MEMORY_TARGET not supported on this system Problem (Database)

- GNU Linux system variables (sysctl configuration commands) integrated use (Linux)

- HTML5 postMessage cross-domain data exchange (Programming)

- 10 useful Linux command line tips (Linux)

- Java reflection summary (Programming)

- Usage Linux device tree (Programming)

- Use preseed script to install Ubuntu 14.04 (Linux)

- The Objects in JavaScript (Programming)

- Reported too many open files Linux solutions (Server)

- Depth understanding of C language (Programming)

- Linux dual physical network card set to a virtual NIC (Linux)

- Ubuntu 14.04.02 LTS startup items erroneous writing / dev / sda1 (win 7 loader) Repair (Linux)

- Ubuntu Apache virtual host configuration (Server)

- MySQL migration tool used in the production environment (Database)

- namespace mechanism Linux kernel analysis (Linux)

- How to experience Unity 8 Mir on Ubuntu 16.04 (Linux)

  Linux disk management practices
  Add Date : 2018-11-21      
  Problem Description

Kenichi small partner to my reaction laboratory Confluence knowledge management system can not upload attachments, after the investigation found that a lack of disk space, use the df command to view disk usage

Lab Linux file server has three hard drives, respectively, 250GB, 1TB, 1TB, corresponding device file names are / dev / sda, / dev / sdb, / dev / sdc, but the figure seen only two hard drives information, because the second physical disk as a backup third RAID1 disks.

Now mount the file system information is as follows:

Disk partition device mount point size availability
Disk1 Partition1 / dev / sda1 194MB 62% / boot
Disk1 Partition2 / dev / sda2 40GB 100% /
Disk1 Partition4 / dev / sda4 104GB 31% / var / ftp / cluster
Disk3 Partition1 / dev / sdc1 917GB 2% / home
By following du command to see Confluence working directory / var / atlassian occupied 22GB:

[Root @ archlab-server2 /] # du -sh / var / atlassian /
22G / var / atlassian /
Was set up when the server disk unreasonable planning, which leads to insufficient disk space phenomenon now. It now only remedy is to re-divide the disk partition, the initial plan was to complete the following two steps:

Reduce the size of the partition 1 on disk 3, add a new partition on the disk 3;
The new partition mounted under / var / atlassian directory, copying the previous catalog file on disk 1 of the previous release to the new partition and partition space.
Reduce the partition size

First, reduce the size of the first partition Disk3, since the partition has been mounted under the / home directory, so must first uninstall the partition (make a backup before uninstalling, all copies of the directory to another partition), use command umount unloading:

[Root @ archlab-server2 /] # umount / dev / sdc1
umount: / home: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof (8) or fuser (1))
Tip device busy information is due to the / home directory is being used by a process, you can use the fuser command to terminate all processes that use the directory:

[Root @ archlab-server2 /] # fuser -km / home
/ Home: 2639m
Then complete the Uninstall. You can now resize the partition, there are two ways: one is to use the command line to operate, the other is to use graphical software GParted. In fact, Linux graphical software also call the command to achieve, here for brevity I installed GParted, use the software to complete the resizing partitions (the software operation is very simple, do not say)

The / dev / sdc1 to adjust to nearly 420GB. Finally do not forget the command mount / dev / sdc1 to remount the / home directory, or access the file / home directory will automatically go to the next / dev / sda2 partition Looking for:

[Root @ archlab-server2 /] # mount / dev / sdc1 / home
New Partition

Then in unallocated over 500 GB on off another partition (200GB), you can also use GParted to allocate, and here I use the fdisk command to complete:

[Root @ archlab-server2 /] # fdisk / dev / sdc

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): p

Disk / dev / sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors / track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical / physical): 512 bytes / 4096 bytes
I / O size (minimum / optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x358b358b

   Device Boot Start End Blocks Id System
/ Dev / sdc1 * 1 54721 439544800+ 7 HPFS / NTFS
Partition 1 does not start on physical sector boundary.

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

Expert command (m for help): w
The partition table has been altered!
M using the command to list all of the statement's meaning, p command to print out all the information on the disk partition, n to create a partition, enter a new partition information (such as the partition type, partition start end position, etc.), where the new partition the 200GB of space, you have finished entering w before actual operation is performed to change the partition table.

Format the partition

After the completion of the partition you want to format the file system using the mkfs command to specify the type of file system format:

[Root @ archlab-server2 /] # mkfs -t ext4 / dev / sdc2
Mounting partitions

Add and format a partition after, went to the last step, the partition mounted under / var / atlassian directory, follow these steps:

The / dev / sdc3 mount to a temporary directory, such as / home / tmp
Under the / var / atlassian cut to catalog all files under / home / tmp, is / dev / sda2 free up space
The / dev / sdc3 unloading from / home / tmp directory
Finally, the / dev / sdc3 mount / var / atlassian under
Since the two are using mount and umount command to complete, not to write a command procedure.

So by the above steps to complete the data / var / atlassian directory stored in the disk by the previous 1 to 2 partitions new disk partition transfer 2 on 3,

Finally, we use the View command lsblk block device block device to view system information:

[Root @ archlab-server2 /] # lsblk
sda 8: 0 0 149.1G 0 disk
sda1 8: 1 0 200M 0 part / boot
sda2 8: 2 0 40G 0 part /
sda3 8: 3 0 4G 0 part [SWAP]
sda4 8: 4 0 104.9G 0 part / var / ftp / cluster
sdb 8:16 0 931.5G 0 disk
sdb1 8:17 0 931.5G 0 part
sdc 8:32 0 931.5G 0 disk
sdc1 8:33 0 419.2G 0 part / home
sdc2 8:34 0 331.5G 0 part / var / atlassian
to sum up

Several master disk management commands - df / du / fdisk / mkfs / mount / umount etc.
Understand disk partitions, file system, mount point concept
- Sudo and Root Account in Ubuntu related (Linux)
- SQLite database commonly used sentences and visualization tools on MAC MeasSQLlite use (Database)
- 10 tips daily Docker (Server)
- Elasticsearch 2.20 Highlight (Server)
- error 1819 (HY000): your password does not satisfy the current policy requirements (Database)
- Mount NFS network file system (Linux)
- Source code is installed MySQL 5.6.28 (Database)
- apt-get install openstack pkg Troubleshooting (Linux)
- To execute the cp command prompt type skip folder under CentOS (Linux)
- Kubernetes cluster deployment (Server)
- Linux package manager - yum (Linux)
- Oracle table compression Technology Introduction (Database)
- Clojure programming languages: take full advantage of the Clojure plug-in Eclipse (Programming)
- Jump table (skiplist) of code (Programming)
- Linux, MySQL root privilege escalation another method (Linux)
- Understanding Java classes (Programming)
- PostgreSQL 9.4.3 Installation and Configuration under CentOS 6.5 (Database)
- Oracle: RETURNING clause (Database)
- CentOS7 installation GAMIT and GMT (Linux)
- Java garbage collection and heap memory layout (Programming)
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.