J
J
JimJack2020-02-05 12:03:02
linux
JimJack, 2020-02-05 12:03:02

How to swap a disk in Linux?

Greetings! I need what is called a sanity check, that is, a sanity check.

So, the situation is this:

There is a server with CentOS 7.4 on board. It runs an application that stores user data in /mnt/files . The data is already over 400 GB, and the disk is only 500 ... That's the problem, the disk will soon run out.

What I want to do is add a new 2TB drive, stop the application, rsync all the data from the old drive, mount /mnt/files on the new drive, run the application. PROFIT.

Is this the right plan? Or delusional? What is the best way to solve the problem?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Melkij, 2020-02-05
@melkij

add a disk, mount to another location
make rsync
stop the application
make rsync
unmount the old disk remount
the new disk in /mnt/files
start the application

Z
Zzzz9, 2020-02-05
@Zzzz9

One Germanjon option, mount. Another option is to take a disk image (I use Clonzilla), restore to a new one, boot, expand the partition to max (parted)

G
Germanjon, 2020-02-05
@Germanjon

Normal option.
There is another one, if the data is stored structured by folders:
1. Create a folder in the root and mount a 2 TB disk there.
2. Create a slink in the /mnt/files folder to the location of the new disk.
3. Make sure that the application stores data in a new location.

K
Karpion, 2020-02-06
@Karpion

In FreeBSD, often a new disk is mounted on top of an old one via UnionFS. Then the file is read:

  • from a new disk if it is there;
  • from the old disk, if the new one does not have it.
And when you change - the file on the old disk remains as it was, on the new one it is created with a record of the changes. With touch - the file is transferred to a new disk. Advantage - no need to stop the service (except to turn off the computer when a new disk is physically connected).
On Linux d.b. something similar.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question