1

I'm a new linux user and when I was installing Ubuntu, I have created 2 partitions: first (50gb) for /root folder (not sure but something like that) and second one for /usr folder (I thought all the user files stored there as seen that programmes are being installed there. So I'm facing a problem where my Downloads folder is on a first partition which is only 50gb. Is there a way to resize them / delete second partition and extend first one without losing /usr data?

  • Assuming you're using a filesystem that can be extended (which is the default in Ubuntu), yes. Please edit your question to include the output of lsblk. Also, please clarify what drives and partitions you wish to use and for what purpose. For a brief explanation of the file system hierarchy standard, see: en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard – Schives May 26 '17 at 1:59
  • 2
    Why would you have more than one partition? If you can not answer that question, you should have one partition. Default for new users in Debian is one plus swap, where swap is the same size as amount of RAM. – hschou May 26 '17 at 6:37
1

Since you are a new Linux user, as hschou stated, please avoid creating a suite of partitions. It will only cause you grief. Get comfortable with Linux first, then play with partitioning schemes.

At this point, to be honest the simplest option is for you to start over. Back up whatever you want to keep and re-install Ubuntu with only two partitions: swap and for / (everything else).

To answer your question: no, that would wipe out /usr. For example if you have something like this:

-----------------------------
| sda1  | sda2              |
-----------------------------

And you delete sda2 in order to make sda1 larger you'll erase whatever is in sda2.

Now, if the contents of sda2 can fit into the filesystem in sda1, then it'd be possible to do what you're asking, but it's a delicate task; not recommended for those new to Linux.

For completeness, you cannot add space to the front of a partition. You can only add to the back. For example, using the same partitioning example, if you wanted to remove sda1 to enlarge sda2 into it, that won't work at all. You'd have to backup/restore to address that.

In conclusion, your best bet is to reinstall Ubuntu.

  • I agree with the backup part. Instead of just starting over, I would recommend attempting to recover as a learning experience. – StrongBad May 26 '17 at 19:20
  • 1
    Also, adding space to an existing partition is usually not allowed while the partition is mounted and in use (yes, there are exceptions -- but it's not a good idea most times). – 0xSheepdog May 26 '17 at 21:17
0

You can create a Download directory placed in /usr or another partition. And make a soft link named Download to the directory Download.

0

You can use bind mounts to mount directories. Assuming your Downloads directory is /home/jbwz/Downloads you can create a directory /usr/JbwzDownloads (or whatever name you want, but it must be under /usr) and move all the files in /home/jbwz/Downloads into it.

Then add to /etc/fstab:

/home/jbwz/Downloads /usr/JbwzDownloads none bind

The key thing to remember is that if you delete /usr/JbwzDownloads the files in /home/jbwz/Downloads will get deleted too. While it will look like you have two copies of every file, you do not.

Slightly better would be to bind mount /home, but moving all files from /home to /usr/home is a bit tricky as some files might be locked. The easiest way is probably to log in as root in a tty.

The best way is to fix your partitions by carefully moving things around. It can be a good learning experience, but make sure you have a backup of all your data and a live cd to recover from. The steps are something like

  1. Boot into a live cd
  2. Mount your two partitions
  3. Move everything in the 2nd partition into a directory called usr
  4. Move everything in the 1st partition to the 2nd partion (assuming there is space)
  5. Delete the 1st partition
  6. Resize the 2nd partition
  7. Edit fstab
  8. Reboot
0

Where's your /home partition?? and why was the reason to create only two partitions??

Usually when you installing Manually an OS Linux must create four partitions:

/dev/sxx - / (root)

/dev/sxx1 - /home (The directory that you have your user files Music, pictures)

/dev/sxx2 - /boot (The booteable option if you have both OS)

/dev/sxx3 - SWAP (The partition that support to you OS' process)

I think you're some confused about partitions for Linux. Check this link: https://en.wikipedia.org/wiki/Disk_partitioning

And about the partition resizing I got my own way: you must emulate an OS from live-storage (Live USB, etc) save the necessary files, and erase the partition that you want resize through Gparted, cfdisk and finally reinstall the OS with the partitions that I told you before.

I hope this answer gonna be clear some questions about your trouble. Greetings!

  • lvm makes resizing less painful. – user1133275 May 26 '17 at 6:24
  • I don't think so, when is using by newbies on Linux doesn't simplify the partitionate. – Kangaroo May 26 '17 at 16:00
  • Sure it's an extra layer but it permits resize without reboot. – user1133275 May 26 '17 at 16:15
  • A separate partition for /home has never been a requirement, but it is advised, in order to make backups and recovery easier. – Mio Rin May 26 '17 at 22:02
  • Well I guess to understand almost Linux OS the newbies, should to know how many partitions make a default installation, personal opinion. – Kangaroo May 26 '17 at 22:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.