How to backup and restore a RAID1 partition on CentOS 6

General support questions
Post Reply
soopaflyjay
Posts: 2
Joined: 2018/01/01 12:42:58

How to backup and restore a RAID1 partition on CentOS 6

Post by soopaflyjay » 2018/01/01 13:29:09

Dear all
I have a server where i'm running mysql and postgresql databases based on CentOS 6.8 x86_64. the problem is that the /var directory (where those db are running) is mounted on a 50Gb partition which already full (95%). So, i'm looking for a way to move the content of this partition to a new bigger one where i can remount /var directory. There are 300Gb space free remaining on my HDD and it's a RAID1 disk.

Thanks for your help.
Attachments
disk space.jpg
disk space.jpg (162.85 KiB) Viewed 1242 times
Disk utility 1.jpg
Disk utility 1.jpg (135.69 KiB) Viewed 1242 times

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to backup and restore a RAID1 partition on CentOS 6

Post by TrevorH » 2018/01/01 14:36:41

Just think how easy this would've been if you'd used LVM... you could've umounted /home, resize2fs'ed the filesystem on it to a smaller amount, lvresized the LV then lvresize -r'ed your /var. Done.

You don't seem to be using your /dev/md126p7 at all. Perhaps you can delete that (and lose whatever its contents are) and then extend your /dev/md126p6 into it by changing the ending sector number and then resize2fs the filesystem on top of it. If md126p7 is swap then you probably don't need 16GB of it anyway...
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

soopaflyjay
Posts: 2
Joined: 2018/01/01 12:42:58

Re: How to backup and restore a RAID1 partition on CentOS 6

Post by soopaflyjay » 2018/01/01 17:40:13

md126p7 is a swap partition.
Can i just delete it and relocate it in a new partition that i'll create from the free space, and extend my md126p6 partition on that space ?

tunk
Posts: 1205
Joined: 2017/02/22 15:08:17

Re: How to backup and restore a RAID1 partition on CentOS 6

Post by tunk » 2018/01/01 18:38:19

You may be able to extend the partition by using GParted Live.
Whatever you end up doing, I strongly suggest that you run a (full) backup.

billwest
Posts: 154
Joined: 2006/11/19 10:50:31
Location: Perth, Western Australia

Re: How to backup and restore a RAID1 partition on CentOS 6

Post by billwest » 2018/01/02 09:42:30

You could do the following:

Place /var on your / partition, ie /dev/md126p4), which has 174Gb free.

Mount /var/log on the partition which is currently filling up (ie /dev/md126p6).

Just a thought.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to backup and restore a RAID1 partition on CentOS 6

Post by TrevorH » 2018/01/02 12:13:13

md126p7 is a swap partition.
Can i just delete it and relocate it in a new partition that i'll create from the free space, and extend my md126p6 partition on that space ?
Basically, yes. You'll need to swapoff it first, remove it from fstab and add it back later after recreating it and use mkswap on the new partition/LV then add it back to fstab and use swapon -a to activate it to test that it works.

If you use fdisk -lu to list the existing partitions, that will include the exact starting sector number of each partition. You'll need to delete and redefine /dev/md126p6 so that it starts on the exact same sector number and ends on the newer (larger) one. Save that when you're happy, reboot then you can resize2fs the filesystem that's on that partition.

Since this is dangerous, backups are recommended.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply