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.
Hello All,
I have recently installed a debian based OS on my system, with 2 primary partitions SDA1 and SDA2 SDA1 has my boot partition and SDA2 has 2 logical partitions and the swap.
I've tried shrinking the sda2 filesystems in Gparted (while in a live cd so I could unmount them) and expanding the sda1 but I have no luck. I just get unallocated disk space for SDA2 and it still doesn't allow me to expand sda1 past its original 9.31 GB in size... any ideas?
I ran into this problem when installing some software. It seems that files are being saved into my SDA1 filesystem instead of my rather large sda2... an alternate solution could be figuring out how to make sure all of my files are just getting saved to sda2...
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
Perhaps you don't have to.
I am assuming your new software is installed in /usr. If it is not, substitute the name of the directory it is installed in.
In the free space on sda2 create a new partition. Mount this partition on an arbitrary place in you file system. For example (as root):
mkdir /mnt/usr
mount /dev/sda6 /mnt/usr (I assume the new partition is sda6, change as needed)
rsync -auv /usr/ /mnt/usr/
This copies everything to the new partion.
Now change your fstab and mount the new partition as /usr.
In Debian partitions are mounted by UUID. Find the UUID of your new partition with the blkid command.
Then reboot.
When you are done, check df -h to make sure you are using the right partition as /usr.
Finally when you are sure you are using the correct partition, mount the old partition below /mnt/usr and delete the files to free up the old space on sda1.
I've since reimaged the machine thinking that putting it all on one partition would be better... but no luck...
Quote:
Originally Posted by EDDY1
Post output of
&
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=394c67f7-11b3-463c-ae27-89e3effa24de / ext4 errors=remount-ro 0 1
# /home was on /dev/sda6 during installation
UUID=9591bfe5-fa89-4fef-9fe5-655443e9369c /home ext4 defaults 0 2
# swap was on /dev/sda5 during installation
UUID=c34c2ae4-f86b-499a-b5a2-3dc4ed8d2cea none swap sw 0 0
and
Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0004efe0
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 19531775 9764864 83 Linux
/dev/sda2 19533822 488396799 234431489 5 Extended
/dev/sda5 19533824 36304895 8385536 82 Linux swap / Solaris
/dev/sda6 36306944 488396799 226044928 83 Linux
Ok
Shrink /home sda6 from left
Move swap sda5 to right
Shrink Extended sda2 from left
Grow sda1 to right.
That's exactly what I tried to do.
But when I did that I was only able to get to step 3 in your list there. For some reason it wouldn't allow me to increase SDA1 past it's original size, regardless of how much unallocated space I had directly next to it. it was as if the two partitions were physically segregated.
Last edited by cynicalpsycho; 08-19-2014 at 10:46 PM.
Because you have to take the space from /home & it's at the end of the disk. That's why you start there resizing & creating free space before each partition until you've moved that space to where it can beused in /.
But when I did that I was only able to get to step 3 in your list there. For some reason it wouldn't allow me to increase SDA1 past it's original size, regardless of how much unallocated space I had directly next to it. it was as if the two partitions were physically segregated.
Get to that point and make sure you "apply" the changes. Run the parted command again so we can see what's happening - I see no (insufficient) free space listed. Then try to expand sda1 - and don't forget to apply it again.
Sorry guys I took the cowards way out
Nuked my kali install and just did a reinstall with the whole thing on one partition.
Prior to that however I was able to follow eddys guidance... at least for the most part... I was allowed to expand my root partition in the GUI. But during the expansion process I kept getting errors from GParted which effectively prevented the completion of the process.
I genuinely appreciate the help you guys offered, sorry I couldn't implement it properly.
FYI - there's always a way around this kind of problem. In this case, you could have used "du -shx /* | sort -h" to see which directories in your root filesystem were using the most space. Typical choices would be /usr or /var. Then you create a new partition, somewhere, anywhere, doesn't matter...just make a new partition that's at least as large as you need to hold your largest directory found above plus room for growth.
Then you boot up a live CD, mount all of your filesystems so you can work with them, "rsync -a" your /usr (or whatever it happened to be) (of course since you're in a live CD, it won't be /usr, it'll be /path/to/mount/point/usr, but I'm assuming you know that) directory to your new partition, move your /usr directory to, say, /usr.backup (again it on't be /usr or /usr.backup, it'll be /path/to/mount/point/usr, etc), edit your /etc/fstab (once again it won't be /etc/fstab, it'll be /path/to/mount/point/etc/fstab) to mount your new "/usr" partition to /usr, and then reboot.
If all goes well, /usr will transfer seamlessly onto your new partition, and once you verify everything is working correctly you can delete /usr.backup and clear out the space on your root filesystem.
Since you'll be working with root filesystems mounted in subdirectories of a different root filesystem (your live CD), you need to make absolutely sure you understand the steps I described above before you try this. If you understand the concept, then adapting the instructions to your specific case should be very simple, and you should be able to accomplish this without issue. I do this all the time on new server installations where /home needs to be located on a separate RAID array that isn't initialized/available during the OS installation process. It's simply a matter of:
1) install the OS
2) set up the partitions you want to transfer data onto
3) if the directory that you want to transfer to the new partition is critical to the operation of the OS, then reboot to a live CD, mount your partitions, and adapt all paths in the following steps as necessary
4) "rsync -a" the directory of interest onto its new home
5) move the old directory to a new name so it doesn't interfere, but is still available as a backup "just in case"
6) create the directory again (since you just renamed the old one, we need a blank copy in its place to serve as a mount point for your new partition)
7) mount the partition at its new home, verify all of the necessary files are available as before (no weird directory changes have taken place, /usr/lib/file is still /usr/lib/file, etc)
8) edit /etc/fstab appropriately (if you are in a live CD environment, adapt the path to the appropriate fstab accordingly)
9) reboot
10) if it all works correctly, delete the backup and move on with your life
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.