Results 1 to 9 of 9
I'm pretty new to linux and after much googling and head scratching decided I need a bit of help with this one.
I've been using a dedicated server for our ...
- 06-09-2011 #1Just Joined!
- Join Date
- Jun 2011
- Posts
- 5
Partitioning / Mounting
I'm pretty new to linux and after much googling and head scratching decided I need a bit of help with this one.
I've been using a dedicated server for our site and ran out of space so have upgraded from 300GB to 500GB of disk space.
The host as added the space but it needs assigning to a partition (or just mounting im not sure???).
I want to move the files out of /var which is full and in to two directories (say /data1 and /data2). This is partly to avoid reaching the maximum file limit which I think could happen if it all just stays in /var?
So a few questions:
1. Is it best to have /data1 and /data2 as separate partitions? Basically as 1 fills up I will move on to 2, and create /data3 and so on as I need more space.
2. How do I go about assigning the new disk space to to the new partitions?
3. If I move loads of stuff out of /var and in to the new /data1 directory, can I reassign the excess space on the existing /var partition after I delete the old copies to /data1 and /data2 and if so how?
Here is the output of ds and fdisk:
df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hda1 9621848 3236788 5896284 36% /
/dev/hda5 9765248 2458592 7306656 26% /usr
/dev/hda6 271327232 269261440 2065792 100% /var
none 1048576 8 1048568 1% /tmp
fdisk -l
Disk /dev/hda: 500.0 GB, 500000882688 bytes
255 heads, 63 sectors/track, 60788 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 1217 9775521 83 Linux
/dev/hda2 1218 1461 1959930 82 Linux swap / Solaris
/dev/hda4 1462 36473 281233890 5 Extended
/dev/hda5 1462 2678 9775521 83 Linux
/dev/hda6 2679 36473 271458306 83 Linux
Much thanks in advance!
- 06-09-2011 #2Linux Guru
- Join Date
- May 2011
- Posts
- 1,838
You say you've upgraded from 300 to 500GB - so does that mean you've just replaced your old (300GB) system drive with a new (500GB) one? Did you use dd or something to clone the drive?
Anyway, if I am reading your fdisk output right, it looks like you have space for another partition: your last partition, hda6, end on 36473, but your disk reports 60788 cylinders. Plus, your df output shows only about 276GB of addressable storage space. If so, you'd need to create a partition, (or two or three), format it, and mount it to /data1 or wherever.
Note that you might not be able to just move stuff out of /var too, some stuff expects to be there, so you may have to do symlinks, etc.
On the other hand, is it that your additional hard drive space on a secondary drive, etc.?
- 06-09-2011 #3Just Joined!
- Join Date
- Jun 2011
- Posts
- 5
Hey thanks for replying (and nice name choice is its after the band!). Its a 'dynamic cloud server' from 1 and 1, so im guessing its just an extra disk has been added not sure how it works, the existing structure is the same.
What would be the commands I need to run if I want to create 2 partitions from the remaining space, format them and then mount them as /data1 and /data2 ?
Is there a command to reassign space from the /var partition to the new ones once I have copied the files and freed up some space?
I dont want to move all of /var, its just the directories currently inside webroot which file uploads go to
- 06-09-2011 #4Linux Guru
- Join Date
- May 2011
- Posts
- 1,838
Not the band, the movie (still a nice choice?).
First off, i don't know jack squat about cloud computing, so there.
Secondly, if this is a production server, then I'd hope whomever gave you the hard drive space at least told you how to access it
If you'd just like to see what drives are attached to your system, do this:
It should spit back something like:Code:ls -d /sys/block/[sh]d*
/sys/block/sda /sys/block/sdb
where the first hard drive detected is sda, the second is sdb, and so on.
You can do this to get more info about the drives:
If you do find additional drives, I can help you partition them if you want. I must say I'm kind of leery of helping you partition your system drive, esp. if it is production, etc.Code:grep -H . /sys/block/[sh]d*/device/model
Having said all that, it was pretty straight forward, you just have to :
1. partition the drive
2. *reboot (if a drive currently in use)
3. format with filesystem of choice
4. configure for auto-mounting and mount it
Then you can move files here and there and everywhere, etc.
* actually, you can use a partx hack to avoid rebooting, if necessary
EDIT: This doesn't take into account iSCSI, NAS, NFS, GFS, etc, i.e. all network-based storage, i'm just talking about drives physically attached to your server. and even then, they could be in other places, depending on RAID hardware, etc.
- 06-10-2011 #5Just Joined!
- Join Date
- Jun 2011
- Posts
- 5
hmmm ok well I got this:
/sys/block/hda /sys/block/hdd
/sys/block/hda/device/modalias:ide:m-disk
/sys/block/hdd/device/modalias:ide:m-cdrom
So just the one hard drive I assume. Does that make it difficult then? It is a production server and it would be a nightmare if I trashed any of the existing partitions!
- 06-10-2011 #6Just Joined!
- Join Date
- Jun 2011
- Posts
- 5
Also I've been reading up on parted. Output of parted -l is:
Number Start End Size Type File system Flags
1 32.3kB 10.0GB 10.0GB primary ext3
2 10.0GB 12.0GB 2007MB primary linux-swap
4 12.0GB 300GB 288GB extended
5 12.0GB 22.0GB 10.0GB logical xfs
6 22.0GB 300GB 278GB logical xfs
Am I right In thinking what I want to do is resize the extended partition 4 up to 500GB and then create new logical partitions in the same file system as 5 and 6 between 300GB and 500GB?
I dont know much (anything!) about the differences in file systems but from the parted docs it looks like it doesn't support creating xfs, is it ok to use one of the other types for the new partitions or do I need to do something else to make them xfs?
- 06-11-2011 #7Linux Guru
- Join Date
- May 2011
- Posts
- 1,838
Yes, that sounds right. At least I know you can only have 4 primary partitions, and 1 extended partition (with I don't know how many logical partitions in it...lots).
Come to think of it, I don't know why you can't just make the remaining space your 3rd primary partition (which would give you 3 primary and 1 extended - totally legit), but maybe someone else know?
Anyway, I've never done that before (resizing an extended partition)...sounds kind of scary to me. I'm not very familiar with parted, does it support that? I did use a GParted Live Rescue CD once (which gives you a nice graphical interface to parted) and it saved my cookies. You might want to check it out.
As to xfs, you can always use mkfs.xfs, once you've made the partition. It is probably packaged for your distro already, for example, in Fedora/ Red Hat, you could 'yum install xfsprogs'. The website for XFS is here:
SGI - Developer Central Open Source | XFS
good luck!
- 06-11-2011 #8Just Joined!
- Join Date
- Jun 2011
- Posts
- 5
thanks, can anyone confirm im ok to increase the size of the existing extended partition, it looks like from the parted docs it is but I dont wanna risk trashing my existing data and have no way to back up atm.
- 06-11-2011 #9
Normally yes but with the usual proviso that you should take a backup of any data you don't want to lose. I'm afraid that I'm another one who knows nothing about the cloud so I don't know if that is a game changer. Does your hosting company provide any tech support?
If we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)
My new blog. It's probably not as good as I think it is.


Reply With Quote