Problem description
The little partner of the Institute is reacting to me. The Confluence knowledge management system in the laboratory cannot upload attachments, and after troubleshooting, it df
is found that disk space is insufficient, use the command to view disk usage such as:
The lab's file server has three hard disks, 250GB, 1TB, 1TB respectively, the corresponding device filenames are,,, /dev/sda1
/dev/sda2
but the /dev/sda3
figure sees only two hard disk information, because the second disk as a physical RAID1 back up the third disk.
Now the file system mount information is as follows:
Disk Partitioning |
Device Name |
size |
Available Utilization |
mount point |
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 |
You can see du
that the working directory of Confluence /var/atlassian
has occupied 22GB with the following command:
[root@archlab-server2 /]# du -sh /var/atlassian/22G /var/atlassian/
When the server was set up when the disk planning is unreasonable, leading to the current lack of disk space phenomenon. The only way to remedy this is to repartition the disk partition, and the initial plan is to complete the following two steps:
- Reduce the size of partition 1 on disk 3 and add a new partition on disk 3;
- Mount the new partition to the
/var/atlassian
directory, copy the files from the previous directory on disk 1 to the new partition and free up the previous partition space.
Reduce partition size
First, reduce the size of the first partition of the DISK3, because the partition is already mounted to the /home
directory, so first unmount the partition (make a backup before uninstalling, copy the directory to another partition), and use the umount
command to unload:
[[email protected] /]# umount /dev/sdc1is busy. someaboutthat use theisby lsof(8or fuser(1))
Information that prompts the device to be busy because the directory is being /home
used by a process, fuser
You can use the command to terminate all processes that use the directory:
[root@archlab-server2 /]# fuser -km /home/home: 2639m
Then complete the uninstallation. You can now resize the partition in two ways: one using command-line commands and the other using graphical software GParted. In fact, the graphical software is also called the Linux command to achieve, here for the sake of simplicity I installed GParted, using the software to complete the resizing of the partition (the software operation is very simple, not much to say), such as:
will be /dev/sdc1
adjusted to nearly 420GB.
New Partition
Next, on the unassigned more than 500 GB to separate a partition (200GB), you can also use GParted to allocate, here I use fdisk
the command to complete:
[Email protected]/]# fdisk/dev/sdcwarning:dos-compatible mode is deprecated. It ' s strongly recommended to switch off the mode (command ' C ') and change display units to sectors (Comman d ' u '). Command (M for help): pdisk/dev/sdc:1000.2 GB, 1000204886016 bytes255 heads, sectors/track, 121601 cylindersunits = C Ylinders of 16065 * 8225280 = bytessector size (logical/physical): bytes/4096 bytesi/o size (minimum/optimal): 4 096 bytes/4096 bytesdisk identifier:0x358b358b Device BootStart EndBlocks Id SYSTEM/DEV/SDC1 *1 54721 439544800+7Hpfs/ntfspartition1Does not Start onPhysical Sector Boundary.command (m forHelp): NcommandActionE Extended PPrimaryPartition (1-4) ppartition Number(1-4):2 FirstCylinder (54721-121601,default 54721):Using default value 54721 LastCylinder, +cylindersor+size{K,m,g} (54721-121601,default 121601): + $Gexpert Command (M forHelp): Wthe partitionTablehas been altered!
The instruction m can be used to list the meaning of all instructions, the instruction p print out all the partition information of the disk,n Create a partition, enter information about the new partition (such as the type of partition, the beginning of the partition, etc.), where the new partition is assigned 200GB Space, enter W after completion to perform the actual operation, change the partition table.
formatting partitions
To format the file system after the partition is complete, use the mkfs
command to specify the type of the format file system:
[root@archlab-server2 /]# mkfs -t ext4 /dev/sdc2
Mount Partition
After adding and formatting a partition, go to the final step and mount the partition to the /var/atlassian
directory with the following steps:
- will be
/dev/sdc3
mounted to a temporary directory, such as/home/tmp
- To
/var/atlassian
/home/tmp
free up space by cutting all files under the directory /dev/sda2
- Will
/dev/sdc3
be /home/tmp
uninstalled from the directory
- The final
/dev/sdc3
mount to the /var/atlassian
next
Since all is mount
done using and umount
two commands, the command process is not written.
Then through the above steps to complete the /var/atlassian
directory of data from the previously stored in the Disk 1 partition 2 to the new disk 3 partition 2 on the transfer,
Finally, we use the block device lsblk
View command to view the system block device information:
[Root@archlab-server2/]# lsblkNAMEMAJ: MIN RM SIZE RO TYPE MOUNTPOINTSDA8:0 0 149.1G0Disk├─sda18:1 0 $M0Part/boot├─sda28:2 0 +G0Part/├─sda38:3 0 4G0Part [SWAP]└─SDA48:4 0 104.9G0Part/var/ftp/clustersdb8: - 0 931.5G0Disk├─sdb18: - 0 931.5G0Partsdc8: + 0 931.5G0Disk├─sdc18: - 0 419.2G0Part/home└─sdc28: the 0 331.5G0Part/var/atlassian
Summarize
- Proficiency in several Disk Management commands--/////
df
du
fdisk
mkfs
mount
umount
etc
- Understanding the concept of disk partitioning, file systems, mount points
Linux Disk Management practices