How to resize partitions on a live server











up vote
1
down vote

favorite
1












I purchased a 240G remote server and it has no control panel to change the way the server is partitioned so my root folder is locked to 20G. I have looked through many pages of google results and finally caved to ask here.



Filesystem       Size  Used Avail Use% Mounted on
udev 16G 0 16G 0% /dev
tmpfs 3.2G 1.3M 3.2G 1% /run
/dev/sda2 20G 3.7G 15G 21% /
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/sda1 487M 79M 379M 18% /boot
/dev/sda3 200G 60M 190G 1% /home


I would like for the root to be larger than my home dir because thats where my programs are installed and use the space.










share|improve this question









New contributor




Snipey is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    Did you purchase a physical machine? or are we talking about a remote server you have no physical access to? virtual maybe? Please edit the question and tell us more about the server.
    – Kamil Maciorowski
    Nov 16 at 15:47












  • It was a remote server and the panel does not provide a way to provision it the way I want.
    – Snipey
    Nov 16 at 16:05










  • Can you please add the output of fdisk -l /dev/sda? You may be able to, as suggested by @cybernard, resize (or remove) home, and simply extend root to a sensible size ...
    – tink
    Nov 16 at 23:48















up vote
1
down vote

favorite
1












I purchased a 240G remote server and it has no control panel to change the way the server is partitioned so my root folder is locked to 20G. I have looked through many pages of google results and finally caved to ask here.



Filesystem       Size  Used Avail Use% Mounted on
udev 16G 0 16G 0% /dev
tmpfs 3.2G 1.3M 3.2G 1% /run
/dev/sda2 20G 3.7G 15G 21% /
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/sda1 487M 79M 379M 18% /boot
/dev/sda3 200G 60M 190G 1% /home


I would like for the root to be larger than my home dir because thats where my programs are installed and use the space.










share|improve this question









New contributor




Snipey is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    Did you purchase a physical machine? or are we talking about a remote server you have no physical access to? virtual maybe? Please edit the question and tell us more about the server.
    – Kamil Maciorowski
    Nov 16 at 15:47












  • It was a remote server and the panel does not provide a way to provision it the way I want.
    – Snipey
    Nov 16 at 16:05










  • Can you please add the output of fdisk -l /dev/sda? You may be able to, as suggested by @cybernard, resize (or remove) home, and simply extend root to a sensible size ...
    – tink
    Nov 16 at 23:48













up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






1





I purchased a 240G remote server and it has no control panel to change the way the server is partitioned so my root folder is locked to 20G. I have looked through many pages of google results and finally caved to ask here.



Filesystem       Size  Used Avail Use% Mounted on
udev 16G 0 16G 0% /dev
tmpfs 3.2G 1.3M 3.2G 1% /run
/dev/sda2 20G 3.7G 15G 21% /
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/sda1 487M 79M 379M 18% /boot
/dev/sda3 200G 60M 190G 1% /home


I would like for the root to be larger than my home dir because thats where my programs are installed and use the space.










share|improve this question









New contributor




Snipey is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I purchased a 240G remote server and it has no control panel to change the way the server is partitioned so my root folder is locked to 20G. I have looked through many pages of google results and finally caved to ask here.



Filesystem       Size  Used Avail Use% Mounted on
udev 16G 0 16G 0% /dev
tmpfs 3.2G 1.3M 3.2G 1% /run
/dev/sda2 20G 3.7G 15G 21% /
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/sda1 487M 79M 379M 18% /boot
/dev/sda3 200G 60M 190G 1% /home


I would like for the root to be larger than my home dir because thats where my programs are installed and use the space.







linux partitioning






share|improve this question









New contributor




Snipey is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Snipey is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Nov 16 at 16:05





















New contributor




Snipey is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 16 at 15:44









Snipey

62




62




New contributor




Snipey is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Snipey is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Snipey is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 1




    Did you purchase a physical machine? or are we talking about a remote server you have no physical access to? virtual maybe? Please edit the question and tell us more about the server.
    – Kamil Maciorowski
    Nov 16 at 15:47












  • It was a remote server and the panel does not provide a way to provision it the way I want.
    – Snipey
    Nov 16 at 16:05










  • Can you please add the output of fdisk -l /dev/sda? You may be able to, as suggested by @cybernard, resize (or remove) home, and simply extend root to a sensible size ...
    – tink
    Nov 16 at 23:48














  • 1




    Did you purchase a physical machine? or are we talking about a remote server you have no physical access to? virtual maybe? Please edit the question and tell us more about the server.
    – Kamil Maciorowski
    Nov 16 at 15:47












  • It was a remote server and the panel does not provide a way to provision it the way I want.
    – Snipey
    Nov 16 at 16:05










  • Can you please add the output of fdisk -l /dev/sda? You may be able to, as suggested by @cybernard, resize (or remove) home, and simply extend root to a sensible size ...
    – tink
    Nov 16 at 23:48








1




1




Did you purchase a physical machine? or are we talking about a remote server you have no physical access to? virtual maybe? Please edit the question and tell us more about the server.
– Kamil Maciorowski
Nov 16 at 15:47






Did you purchase a physical machine? or are we talking about a remote server you have no physical access to? virtual maybe? Please edit the question and tell us more about the server.
– Kamil Maciorowski
Nov 16 at 15:47














It was a remote server and the panel does not provide a way to provision it the way I want.
– Snipey
Nov 16 at 16:05




It was a remote server and the panel does not provide a way to provision it the way I want.
– Snipey
Nov 16 at 16:05












Can you please add the output of fdisk -l /dev/sda? You may be able to, as suggested by @cybernard, resize (or remove) home, and simply extend root to a sensible size ...
– tink
Nov 16 at 23:48




Can you please add the output of fdisk -l /dev/sda? You may be able to, as suggested by @cybernard, resize (or remove) home, and simply extend root to a sensible size ...
– tink
Nov 16 at 23:48










1 Answer
1






active

oldest

votes

















up vote
1
down vote














  1. make a backup of home.

  2. umount home.

  3. Use a partitioning tool to shrink or delete and recreate a smaller home.

  4. Create and mount a new partition (parted is a command line tool)


If you can install vncserver and connect remotely you can install and use gparted.



Notes: changing the root volume when its mounted is either not permitted or only permitted with a small number of file systems.



Alternatives:



pretend sda3 is home



    sda4 is new partition



  1. mount /dev/sda4 /temp


Now say the /usr folder is causing your root to be full.



As a precaution your should probably stop all or as many as possible running services.




  1. cp -r /usr /temp

  2. mv usr usr.old

  3. umount /temp

  4. mount /dev/sda4 /usr


verify that the contents match



Restart all services, as needed



modify /etc/fstab and or /etc/mtab as needed so the new partition automatically mounts on reboot.



Alternatively if your distro has a GUI tool feel free to use that.



reboot



If everything is correct delete usr.old



Technically you could copy all the files to your new partition. Then edit fstab and mtab so / points to /dev/sda4 and mount /dev/sda1 to a harmless folder like /useless. After rebooting and verifying everything still works you could delete or not mount /useless or maybe reuse it for something else like /var or /var/log.



Here's some commands I got from the website I listed in the comments.



gparted
print
select /dev/sda3
#delete home
rm 3 (or whatever print tells you the partition number is
mkpart
primary
file system? whatever you want
start? don't know
end? don't know 20gb more that the start?
mkfs.ext4 /dev/sda3 (change the filesystem to whatever)
mkpart
primary
file system? whatever you want
start? don't know
end? don't know 100gb (or etc)more that the start?
mkfs.ext4 /dev/sda4 (change the filesystem to whatever)





share|improve this answer























  • I was trying to do it all via command line as to not install the bloated gui for linux
    – Snipey
    Nov 16 at 22:00










  • @Snipey Then use parted because its CLI. Good luck figuring it out.
    – cybernard
    Nov 16 at 22:12










  • That's where I am at now. Massive headaches....
    – Snipey
    Nov 16 at 23:14










  • @Snipey I am truly sorry to hear the pain your suffer, that is why I gave up and used the GUI. In opensuse there is yast disk which is a CLI gui, but I don't know if your distro offers any tools like that. Maybe this will help tecmint.com/… I googled it for you.
    – cybernard
    2 days ago













Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Snipey is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1376028%2fhow-to-resize-partitions-on-a-live-server%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote














  1. make a backup of home.

  2. umount home.

  3. Use a partitioning tool to shrink or delete and recreate a smaller home.

  4. Create and mount a new partition (parted is a command line tool)


If you can install vncserver and connect remotely you can install and use gparted.



Notes: changing the root volume when its mounted is either not permitted or only permitted with a small number of file systems.



Alternatives:



pretend sda3 is home



    sda4 is new partition



  1. mount /dev/sda4 /temp


Now say the /usr folder is causing your root to be full.



As a precaution your should probably stop all or as many as possible running services.




  1. cp -r /usr /temp

  2. mv usr usr.old

  3. umount /temp

  4. mount /dev/sda4 /usr


verify that the contents match



Restart all services, as needed



modify /etc/fstab and or /etc/mtab as needed so the new partition automatically mounts on reboot.



Alternatively if your distro has a GUI tool feel free to use that.



reboot



If everything is correct delete usr.old



Technically you could copy all the files to your new partition. Then edit fstab and mtab so / points to /dev/sda4 and mount /dev/sda1 to a harmless folder like /useless. After rebooting and verifying everything still works you could delete or not mount /useless or maybe reuse it for something else like /var or /var/log.



Here's some commands I got from the website I listed in the comments.



gparted
print
select /dev/sda3
#delete home
rm 3 (or whatever print tells you the partition number is
mkpart
primary
file system? whatever you want
start? don't know
end? don't know 20gb more that the start?
mkfs.ext4 /dev/sda3 (change the filesystem to whatever)
mkpart
primary
file system? whatever you want
start? don't know
end? don't know 100gb (or etc)more that the start?
mkfs.ext4 /dev/sda4 (change the filesystem to whatever)





share|improve this answer























  • I was trying to do it all via command line as to not install the bloated gui for linux
    – Snipey
    Nov 16 at 22:00










  • @Snipey Then use parted because its CLI. Good luck figuring it out.
    – cybernard
    Nov 16 at 22:12










  • That's where I am at now. Massive headaches....
    – Snipey
    Nov 16 at 23:14










  • @Snipey I am truly sorry to hear the pain your suffer, that is why I gave up and used the GUI. In opensuse there is yast disk which is a CLI gui, but I don't know if your distro offers any tools like that. Maybe this will help tecmint.com/… I googled it for you.
    – cybernard
    2 days ago

















up vote
1
down vote














  1. make a backup of home.

  2. umount home.

  3. Use a partitioning tool to shrink or delete and recreate a smaller home.

  4. Create and mount a new partition (parted is a command line tool)


If you can install vncserver and connect remotely you can install and use gparted.



Notes: changing the root volume when its mounted is either not permitted or only permitted with a small number of file systems.



Alternatives:



pretend sda3 is home



    sda4 is new partition



  1. mount /dev/sda4 /temp


Now say the /usr folder is causing your root to be full.



As a precaution your should probably stop all or as many as possible running services.




  1. cp -r /usr /temp

  2. mv usr usr.old

  3. umount /temp

  4. mount /dev/sda4 /usr


verify that the contents match



Restart all services, as needed



modify /etc/fstab and or /etc/mtab as needed so the new partition automatically mounts on reboot.



Alternatively if your distro has a GUI tool feel free to use that.



reboot



If everything is correct delete usr.old



Technically you could copy all the files to your new partition. Then edit fstab and mtab so / points to /dev/sda4 and mount /dev/sda1 to a harmless folder like /useless. After rebooting and verifying everything still works you could delete or not mount /useless or maybe reuse it for something else like /var or /var/log.



Here's some commands I got from the website I listed in the comments.



gparted
print
select /dev/sda3
#delete home
rm 3 (or whatever print tells you the partition number is
mkpart
primary
file system? whatever you want
start? don't know
end? don't know 20gb more that the start?
mkfs.ext4 /dev/sda3 (change the filesystem to whatever)
mkpart
primary
file system? whatever you want
start? don't know
end? don't know 100gb (or etc)more that the start?
mkfs.ext4 /dev/sda4 (change the filesystem to whatever)





share|improve this answer























  • I was trying to do it all via command line as to not install the bloated gui for linux
    – Snipey
    Nov 16 at 22:00










  • @Snipey Then use parted because its CLI. Good luck figuring it out.
    – cybernard
    Nov 16 at 22:12










  • That's where I am at now. Massive headaches....
    – Snipey
    Nov 16 at 23:14










  • @Snipey I am truly sorry to hear the pain your suffer, that is why I gave up and used the GUI. In opensuse there is yast disk which is a CLI gui, but I don't know if your distro offers any tools like that. Maybe this will help tecmint.com/… I googled it for you.
    – cybernard
    2 days ago















up vote
1
down vote










up vote
1
down vote










  1. make a backup of home.

  2. umount home.

  3. Use a partitioning tool to shrink or delete and recreate a smaller home.

  4. Create and mount a new partition (parted is a command line tool)


If you can install vncserver and connect remotely you can install and use gparted.



Notes: changing the root volume when its mounted is either not permitted or only permitted with a small number of file systems.



Alternatives:



pretend sda3 is home



    sda4 is new partition



  1. mount /dev/sda4 /temp


Now say the /usr folder is causing your root to be full.



As a precaution your should probably stop all or as many as possible running services.




  1. cp -r /usr /temp

  2. mv usr usr.old

  3. umount /temp

  4. mount /dev/sda4 /usr


verify that the contents match



Restart all services, as needed



modify /etc/fstab and or /etc/mtab as needed so the new partition automatically mounts on reboot.



Alternatively if your distro has a GUI tool feel free to use that.



reboot



If everything is correct delete usr.old



Technically you could copy all the files to your new partition. Then edit fstab and mtab so / points to /dev/sda4 and mount /dev/sda1 to a harmless folder like /useless. After rebooting and verifying everything still works you could delete or not mount /useless or maybe reuse it for something else like /var or /var/log.



Here's some commands I got from the website I listed in the comments.



gparted
print
select /dev/sda3
#delete home
rm 3 (or whatever print tells you the partition number is
mkpart
primary
file system? whatever you want
start? don't know
end? don't know 20gb more that the start?
mkfs.ext4 /dev/sda3 (change the filesystem to whatever)
mkpart
primary
file system? whatever you want
start? don't know
end? don't know 100gb (or etc)more that the start?
mkfs.ext4 /dev/sda4 (change the filesystem to whatever)





share|improve this answer















  1. make a backup of home.

  2. umount home.

  3. Use a partitioning tool to shrink or delete and recreate a smaller home.

  4. Create and mount a new partition (parted is a command line tool)


If you can install vncserver and connect remotely you can install and use gparted.



Notes: changing the root volume when its mounted is either not permitted or only permitted with a small number of file systems.



Alternatives:



pretend sda3 is home



    sda4 is new partition



  1. mount /dev/sda4 /temp


Now say the /usr folder is causing your root to be full.



As a precaution your should probably stop all or as many as possible running services.




  1. cp -r /usr /temp

  2. mv usr usr.old

  3. umount /temp

  4. mount /dev/sda4 /usr


verify that the contents match



Restart all services, as needed



modify /etc/fstab and or /etc/mtab as needed so the new partition automatically mounts on reboot.



Alternatively if your distro has a GUI tool feel free to use that.



reboot



If everything is correct delete usr.old



Technically you could copy all the files to your new partition. Then edit fstab and mtab so / points to /dev/sda4 and mount /dev/sda1 to a harmless folder like /useless. After rebooting and verifying everything still works you could delete or not mount /useless or maybe reuse it for something else like /var or /var/log.



Here's some commands I got from the website I listed in the comments.



gparted
print
select /dev/sda3
#delete home
rm 3 (or whatever print tells you the partition number is
mkpart
primary
file system? whatever you want
start? don't know
end? don't know 20gb more that the start?
mkfs.ext4 /dev/sda3 (change the filesystem to whatever)
mkpart
primary
file system? whatever you want
start? don't know
end? don't know 100gb (or etc)more that the start?
mkfs.ext4 /dev/sda4 (change the filesystem to whatever)






share|improve this answer














share|improve this answer



share|improve this answer








edited 2 days ago

























answered Nov 16 at 17:21









cybernard

9,63631423




9,63631423












  • I was trying to do it all via command line as to not install the bloated gui for linux
    – Snipey
    Nov 16 at 22:00










  • @Snipey Then use parted because its CLI. Good luck figuring it out.
    – cybernard
    Nov 16 at 22:12










  • That's where I am at now. Massive headaches....
    – Snipey
    Nov 16 at 23:14










  • @Snipey I am truly sorry to hear the pain your suffer, that is why I gave up and used the GUI. In opensuse there is yast disk which is a CLI gui, but I don't know if your distro offers any tools like that. Maybe this will help tecmint.com/… I googled it for you.
    – cybernard
    2 days ago




















  • I was trying to do it all via command line as to not install the bloated gui for linux
    – Snipey
    Nov 16 at 22:00










  • @Snipey Then use parted because its CLI. Good luck figuring it out.
    – cybernard
    Nov 16 at 22:12










  • That's where I am at now. Massive headaches....
    – Snipey
    Nov 16 at 23:14










  • @Snipey I am truly sorry to hear the pain your suffer, that is why I gave up and used the GUI. In opensuse there is yast disk which is a CLI gui, but I don't know if your distro offers any tools like that. Maybe this will help tecmint.com/… I googled it for you.
    – cybernard
    2 days ago


















I was trying to do it all via command line as to not install the bloated gui for linux
– Snipey
Nov 16 at 22:00




I was trying to do it all via command line as to not install the bloated gui for linux
– Snipey
Nov 16 at 22:00












@Snipey Then use parted because its CLI. Good luck figuring it out.
– cybernard
Nov 16 at 22:12




@Snipey Then use parted because its CLI. Good luck figuring it out.
– cybernard
Nov 16 at 22:12












That's where I am at now. Massive headaches....
– Snipey
Nov 16 at 23:14




That's where I am at now. Massive headaches....
– Snipey
Nov 16 at 23:14












@Snipey I am truly sorry to hear the pain your suffer, that is why I gave up and used the GUI. In opensuse there is yast disk which is a CLI gui, but I don't know if your distro offers any tools like that. Maybe this will help tecmint.com/… I googled it for you.
– cybernard
2 days ago






@Snipey I am truly sorry to hear the pain your suffer, that is why I gave up and used the GUI. In opensuse there is yast disk which is a CLI gui, but I don't know if your distro offers any tools like that. Maybe this will help tecmint.com/… I googled it for you.
– cybernard
2 days ago












Snipey is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















Snipey is a new contributor. Be nice, and check out our Code of Conduct.













Snipey is a new contributor. Be nice, and check out our Code of Conduct.












Snipey is a new contributor. Be nice, and check out our Code of Conduct.















 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1376028%2fhow-to-resize-partitions-on-a-live-server%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

Origin of the phrase “under your belt”?