Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi Guys, Need your help, I am new to Linux, I want to increase the size of /home directory. Could you please share the commands / steps by step implementation to resolve this issue.
current details as given below:
-bash-3.2$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 61G 15G 44G 25% /
/dev/sda5 1.5G 1.5G 0 100% /home
/dev/sda2 2.4G 493M 1.8G 22% /tmp
/dev/sda1 1.2G 43M 1.1G 4% /boot
tmpfs 2.0G 0 2.0G 0% /dev/shm
/dev/hdc 2.9G 2.9G 0 100% /media/Enterprise Linux dvd 20100405
You'd need to use something like gparted by this point since you have a partition after/to the right of the /home partition which just happens to be /. This is where using LVM would have been good, since it is good for this type of thing.
The first thing that you need to do is to decide what you want the new sizes of your various partitions to be. 1.5GB for /home was always going to be tight.
Then, you need to back up any data that you have.
After that, you need to boot off a media containing a partition manager, e.g. Gparted Live, change the partition sizes as required, and reboot. If there are any problems with the boot, you'll probably have to boot up with a live media and do some configuring of the system to get it to work.
That's a general overview anyway. For future reference, when deciding on your partitions for a Linux installation, give yourself room to grow as it's usually easier to do that than to repartition afterwards (although, as r3sistance mentioned, LVM makes life easier).
r3sistance's suggestion of gparted is a good one, and as they say, a virtual machine, or a live boot media is the way to go. You will not be able to increase the size of a partition which is mounted, or one which you are using at the time as part of being booted into Linux. Therefore you should boot using a live USB or DVD and run gparted from that so as to be able to access and change your home.
Seems that you might be running a commercial distribution of Linux? Due to the "Enterprise Linux dvd 20100405" shown in your df output. Perhaps you should indicate what distribution you are running to help others to best give you some advice here.
Note also that you will need to run gparted using sudo or as superuser. You should update to indicate whether you know how to do any of this.
Please also understand that while you've posted your df output and described what you want to do, it's poor behavior to just post a question asking for exact commands to accomplish something. Please do some research and also recognize that LQ members a volunteer members of a community where the intentions are to help others to learn about Linux. Therefore someone posting an exact command flow (1) may be giving you something incorrect because they do not have all the information, (2) doesn't help you learn yourself how to accomplish this, except by way of copy/paste.
Thank you all for your help! As suggested i have downloaded the gparted software "gparted-live-0.28.1-1-i686". Could you please help by sharing step by step implementation to extend the size /home dir using gparted software.
where is sda3 and sda4? I know df -h gives different output, but one of them has to be a place holder for more logical partitions. not two of them you're only showing 1,2,5,6 - 3 and 4 are missing.
nevertheless, the easiest way is to shrink one of them or both on either side of 5 then give it to 5
has to be unmounted.
if you can login into root account, then all you got a do is unmount /home the other one, and where is sda4 (and sda3)? then shrink sda4 or sda3 then give that new space to sda5 /home
Code:
mount -a
logout of root then into ./home user
If you want to take away from your root / then just apply the same methodology using the booted gParted. Then just reboot to mount all of them again.
----
256 ssd
Code:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 232.9G 0 disk
├─sda1 8:1 0 500M 0 part <-win 10
├─sda2 8:2 0 97.2G 0 part /media/win10
├─sda3 8:3 0 450M 0 part <- win 10
├─sda4 8:4 0 1K 0 part <------ place holder for my logical drives.
├─sda5 8:5 0 21G 0 part <----- other Linux OS
├─sda6 8:6 0 25.5G 0 part / <-- current Linux OS I am in
└─sda7 8:7 0 88.2G 0 part /home <- self explanatory
you are not showing everything, I think I've stressed that enough. Without that information it is hard to advise other than what I have.
@BW-userx. The numbering is usually based on the position of the entries in the MFT. In this case it looks likely that sda3 is in fact the third entry in the MFT, marked as an extended partition, with the fourth entry not currently being used. sda5 and 6 are the first two logical partitions created under sda3.
The lack of sda3 and sda4 is perhaps a red herring here. However GParted, in my experience, does not like resizing partitions "over" an extended partition divide e.g. it wouldn't like reducing sda2 and then giving that space to an extended ext5.
sudo parted -l should cast some more light on the situation.
To summarise, it looks as if sda5 will have to slice some space out of sda6, which given that sda6 is / may require some mucking around.
The OP still hasn't said how much space they want the new /home to have.
@BW-userx. The numbering is usually based on the position of the entries in the MFT. In this case it looks likely that sda3 is in fact the third entry in the MFT, marked as an extended partition, with the fourth entry not currently being used. sda5 and 6 are the first two logical partitions created under sda3.
The lack of sda3 and sda4 is perhaps a red herring here. However GParted, in my experience, does not like resizing partitions "over" an extended partition divide e.g. it wouldn't like reducing sda2 and then giving that space to an extended ext5.
sudo parted -l should cast some more light on the situation.
To summarise, it looks as if sda5 will have to slice some space out of sda6, which given that sda6 is / may require some mucking around.
The OP still hasn't said how much space they want the new /home to have.
I was ball parking not knowing what 3 and 4 is.
lets see, three primary the 4th as a place holder for extended.
he has
/dev/sda6 61G 15G 44G 25% /
/dev/sda5 1.5G 1.5G 0 100% /home
Ok I see it now, best take off from / root, because sda4 would be his place holder. personally I do now understand why he has it split up like that and keeping it all on the same drive. Boot separate maybe, but tmp separate on same drive? It us temp whatever is in there can be rid of if it starts taking up too much room being kept on / root. so yeah he'd have to push some data around to get it off root.
he's prob watching the high lights of some game -- got a wait for more from him.
Not really. The output of the df command only shows mounted filesystems. I would guess that sda3 and sda4 are swap and the extended partition. The order of the filesystems in the output of the df command does not indicate how they were created.
The only partition to steal space from is the / partition and it would help to see the output of the parted command or fdisk -l (that is a small L) to see how the partitions were created. Normally logical partitions are created in order so sda5 and sda6 should be next to each other so the following should work. Tentative steps are:
shrink sda6 to the size desired
move it to the end of the extended partition
extend sda5 to use the empty space
As suggested you to need run parted from a live CD. As always be sure to have a good backup.
Not really. The output of the df command only shows mounted filesystems. I would guess that sda3 and sda4 are swap and the extended partition. The order of the filesystems in the output of the df command does not indicate how they were created.
The only partition to steal space from is the / partition and it would help to see the output of the parted command or fdisk -l (that is a small L) to see how the partitions were created. Normally logical partitions are created in order so sda5 and sda6 should be next to each other so the following should work. Tentative steps are:
shrink sda6 to the size desired
move it to the end of the extended partition
extend sda5 to use the empty space
As suggested you to need run parted from a live CD. As always be sure to have a good backup.
Ah, good call. It doesn't affect the final operation, but I had forgotten about swap. You never know though, the swap partition might still turn out to be logical partition sda7.
For those that still use legacy MBR, primary partitions can be created in any order. Any primary partition can be labeled as an extended partition and there is no requirement to create all four.
Thank you friends for your quick responses.
Please find given below requested details:
fdisk -l
Disk /dev/sda: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 9137 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 153 1228941 83 Linux
/dev/sda2 154 472 2562367+ 83 Linux
/dev/sda3 473 727 2048287+ 82 Linux swap / Solaris
/dev/sda4 728 9137 67553325 5 Extended
/dev/sda5 728 918 1534176 83 Linux
/dev/sda6 919 9137 66019086 83 Linux
------------------------------------------------------------------------------
sudo parted -l
Warning: Unable to open /dev/hdc read-write (Read-only file system). /dev/hdc has been opened read-only.
Error: Unable to open /dev/hdc - unrecognised disk label.
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 75.2GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Error: Unable to open /dev/md0 - unrecognised disk label.
s
@michaelk: Thank you for sharing implementation steps. I am new to Linux, could you please share the command or if possible any documents to get resolve my requested issue.
shrink sda6 to the size desired---how to do this?
move it to the end of the extended partition---how to do this?
extend sda5 to use the empty space---how to do this?
Please help by sharing steps. Thanks.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.