Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Linux disk management practices     - ImageMagick Tutorial: How to cut images in Linux command line (Linux)

- Zabbix configuration external network mail alarm (Server)

- To use slay kill user processes (Linux)

- pkg-config to use (Linux)

- Linux, how to filter, split, and merge pcap file (Linux)

- Linux crontab use (Linux)

- CentOS 5.5 install ntop (Linux)

- How to Install Foreman under Ubuntu (Server)

- Bash difference in single quotes and double quotes (Programming)

- Installed in the desktop version of Ubuntu Unity Tweak Tool (Linux)

- Learning how to teach safety system to prevent your own IP leakage (Linux)

- Python implementation Bursa transition model (Programming)

- LAN in Ubuntu shared folders to Windows (Linux)

- The AWK use Cygwin tools mysql binlog log viewer (Database)

- MongoDB 3.2 Cluster Setup (Database)

- Install Web-based monitoring tool: Linux-Dash (Server)

- Android Qemu GPS module (Programming)

- Shorewall firewall settings under Ubuntu (Linux)

- The several technical presentation Raid under Linux (Linux)

- HAproxy let IP recording back-end RS (Server)

 
         
  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)
p
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
NAME MAJ: MIN RM SIZE RO TYPE MOUNTPOINT
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
     
         
         
         
  More:      
 
- To use slay kill user processes (Linux)
- Linux kernel source code analysis (Linux)
- Rails 4.1.6 start being given Could not find a JavaScript runtime (Linux)
- GitLab installation configuration notes (Linux)
- Configuring the PXE server in Ubuntu 14.04 (Server)
- To access an Oracle database using Instant Client (Database)
- Linux loopback adapter Driven Design (Programming)
- Linux operation and maintenance of the automated installation and deployment RHEL7.0 Cobbler (Linux)
- 5 steps to help you become a good Docker contributors (Linux)
- Java Prototype Pattern (Programming)
- Daemon under Linux (Linux)
- Atheros AR8161 / AR8162 network card driver problem solving in CentOS 6.4 (Linux)
- GNU Linux use diff to generate a patch with the patch (Linux)
- Compare Oracle MySQL (ICP) index condition pushdown is described (Database)
- Linux system started to learn: Teaches you install Ubuntu 15.04 on VirtualBox (Linux)
- Embedded Linux to solve the problem in the time zone (Linux)
- Performance comparison Fibonacci recursive and non-recursive (Programming)
- Linux use additional rights (Linux)
- SSL VPN SSL VPN access to security websites patron (Linux)
- Python cause yum upgrade error (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.