LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   linux server out of space; what is best option (https://www.linuxquestions.org/questions/linux-newbie-8/linux-server-out-of-space%3B-what-is-best-option-4175542282/)

willc86 05-11-2015 12:58 PM

linux server out of space; what is best option
 
Hey guys,

From researching, I came across 3 different methods to do this; however, just need some recommendations.

my drive @ 150GB is out of memeory

-I have a spare 150GB memory that I can add for free. can I combine the 2 drives? or use a raid 5?

-but a new 1TB hard drive, use clonezilla to back it up and restore it back on the 1TB

-add the 2nd 150gb HD and use LVM?

what do you guys recommend

suicidaleggroll 05-11-2015 01:09 PM

1 - You can't combine them without reinstalling the OS. You can split up your directories though, put some of them on one drive, some on another. It depends on how your space is being used right now. Is the 150 GB more or less split between 2+ locations, or is it all being used in one directory (movie archive or something)?

2 - Possible, but I would recommend just installing from scratch on the 1 TB and using the current drive to re-load your files/settings once the new OS is up

3 - Unless you're already using LVM, that would require you to reinstall the OS as in #1.

RAID 5 requires 3+ drives. You could do RAID 0, but again you're back to reinstalling the OS, loading your files from a backup, etc.

fatmac 05-12-2015 10:08 AM

As you have been happy with your current set up, I would just add the extra disk, move some data off your current drive, change your fstab to use/point to the new disk.

Soadyheid 05-12-2015 11:20 AM

As fatmac says, assuming your second 150Gb drive is going to be for data; music, video, pictures, or whatever you can just mount it somewhere in your system's home directory.

For example, if you make a directory within your home directory called, say, My_stuff then mount your second disk to My_stuff.
Code:

mount /dev/sdx /home/My_stuff
where "sdx" is your new drive.

Then, when you access the My_stuff folder in your home directory you're actually on your "new" disk. :)

In Linux the file system is a tree and everything on the tree is a file, even a disk. Like a Christmas tree bauble, you can hang it anywhere you want on the tree. (though some places are obviously more logical than others!!)

Play Bonny!

:hattip:

willc86 05-12-2015 11:45 AM

ah ok!

so, I was thinking about just buying a 1TB hard drive. this server is mainly a backup for all my virtualization VDI, clonezilla images, and samba share applications.

so, I can just add a 1tb to the current desktop server, then just move it over to the 1tb? but I am going to have to mount it first; """"mount /dev/sdb /files/backup""" that is where I keep all my back up in the current /dev/sda.

I wont have to alter all my rsync scripts or anything like that, right? it will just point right to it? I am just going to keep my 150gb plus add a 1tb.

suicidaleggroll 05-12-2015 12:20 PM

Pretty much, yes. You'll want to mount it somewhere else temporarily, copy over the files, and then remount it in its final home, eg:

Code:

mkdir /mnt/temp
mount /dev/sdb1 /mnt/temp
rsync -av /files/backup/ /mnt/temp/
mv /files/backup /files/backup.old
mkdir /files/backup
umount /mnt/temp
rmdir /mnt/temp
mount /dev/sdb1 /files/backup

Make sure you understand what each of these commands is doing and pay attention to the output. Don't remove /files/backup.old until you're sure the files have been copied over correctly, etc.

kc5hwb 05-12-2015 01:09 PM

Set it up as a logical volume, then you can add more space to it whenever you want. You'll have to backup, repartition your current drive (assuming it isn't LVM partitioned, currently) then restore everything. But the next time this issue comes up, you can just run a lvextend command and add as much space to it as you want without disrupting any of your current files.

standards 05-12-2015 05:56 PM

I like 1 and 2,BUT i think you should see if there is anything you can delete.

syg00 05-12-2015 06:55 PM

I agree with @kc5hwb - if this is an unused drive going in, and there is the prospect of this needing more space in the future (like adding that 1T), LVM is absolutely made for this.
No need for reinstall of anything - just create the lv, copy the data and extend when necessary. All simple commands, mostly "one off".

willc86 05-12-2015 08:42 PM

ok guys, this is what I did

I just added my 1tb hard drive, and also keeping my 150gb

I created a whole partition for /dev/sdb1 and mounted it to /backups
I also edited to /etc/fstab

As of now, I am going to change the paths of all my rsync scripts to point to /backups instead.
so right now, I have /backups. I am thinking of moving all my files over there now and keeping the 150gb free for swap and home user stuff.

would you say this was a good idea?

I do have one question,

how do I know /backups is linked to /dev/sdb1 ?
I tried stat backups but nothing shows up. I know I can use df -h and I see it there, but is there another sure way?

thanks for all of your help! Ill also keep you guys updated! and run a clonezilla from /backups to make sure it works

yancek 05-12-2015 09:14 PM

Quote:

how do I know /backups is linked to /dev/sdb1 ?
Your entry in fstab would do that.

chrism01 05-13-2015 05:05 AM

1. Just use the bare 'mount' cmd (no args) and it'll show you current mounts
2. cat /etc/mtab
3. lsblk

descendant_command 05-13-2015 05:20 AM

As this thread is about evaluating the different options, I hope this isn't too OT...
Quote:

Originally Posted by kc5hwb (Post 5361523)
Set it up as a logical volume, then you can add more space to it whenever you want. You'll have to backup, repartition your current drive (assuming it isn't LVM partitioned, currently) then restore everything. But the next time this issue comes up, you can just run a lvextend command and add as much space to it as you want without disrupting any of your current files.

So if an LV spans several disks and one fails, you loose the lot?
Or is it possible to (fairly easily) rebuild / salvage what is on the unfailed disks?

Most info I've found in my (so far pretty cursory) searching assumes or recommends running LVM on top of RAID for any sort of redundancy/fault tolerance.

chrism01 05-13-2015 05:42 AM

Yep, LVM on its own is a bit like RAID0; its all good until breaks ... ;)
I'd just mount it at a given dir and ensure I've got backups.

syg00 05-13-2015 05:57 AM

You always need backups. No RAID level can protect you from "rm ..." or "mkfs ..." :eek:

snapshot - then backup the snap at your leisure.
Personally I reckon the OP missed a great opportunity to add some flexibility.


All times are GMT -5. The time now is 07:43 PM.