LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 03-04-2024, 06:34 AM   #1
Jason.nix
Member
 
Registered: Feb 2023
Posts: 561

Rep: Reputation: 10
Post How do I add extra space to the disk?


Hello,
Disk space is full:
Code:
$ sudo df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            1.9G     0  1.9G   0% /dev
tmpfs           390M  564K  389M   1% /run
/dev/xvda1      3.6G  3.5G     0 100% /
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/xvda6      5.3G  247M  4.8G   5% /home
tmpfs           390M     0  390M   0% /run/user/0
tmpfs           390M     0  390M   0% /run/user/1000
And:
Code:
$ sudo lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sr0      11:0    1   16M  0 rom  
xvda    202:0    0   10G  0 disk
├─xvda1 202:1    0  3.6G  0 part /
├─xvda2 202:2    0    1K  0 part 
├─xvda5 202:5    0  976M  0 part [SWAP]
└─xvda6 202:6    0  5.4G  0 part /home
I added extra disk space:
Code:
$ sudo lsblk 
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sr0      11:0    1   16M  0 rom  
xvda    202:0    0   20G  0 disk 
├─xvda1 202:1    0  3.6G  0 part /
├─xvda2 202:2    0    1K  0 part 
├─xvda5 202:5    0  976M  0 part [SWAP]
└─xvda6 202:6    0  5.4G  0 part /home
Now I want to add this extra space to / using fdisk tool. How can I do it?

Thank you.
 
Old 03-04-2024, 06:38 AM   #2
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,298
Blog Entries: 61

Rep: Reputation: Disabled
/dev/sr0 is your CD/DVD drive. Your DVD is full. Install to a HDD or SSD.
IGNORE THIS.

Last edited by brianL; 03-04-2024 at 07:53 AM. Reason: Stupid mistake.
 
Old 03-04-2024, 07:04 AM   #3
beachboy2
Senior Member
 
Registered: Jan 2007
Location: Wild West Wales, UK
Distribution: Linux Mint 21 MATE, EndeavourOS, antiX, MX Linux
Posts: 3,972
Blog Entries: 32

Rep: Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465Reputation: 1465
Jason.nix,

Your root partition is full.

This may help:
https://www.opentechguides.com/how-t...tend-root.html
 
Old 03-04-2024, 07:10 AM   #4
Jason.nix
Member
 
Registered: Feb 2023
Posts: 561

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by beachboy2 View Post
Jason.nix,

Your root partition is full.

This may help:
https://www.opentechguides.com/how-t...tend-root.html
Hi,
Thank you so much for your reply.
My disk is not LVM:
Code:
$ sudo fdisk -l
Disk /dev/xvda: 20 GiB, 21474836480 bytes, 41943040 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
Disklabel type: dos
Disk identifier: 0x272a55d8

Device     Boot   Start      End  Sectors  Size Id Type
/dev/xvda1         2048  7624703  7622656  3.6G 83 Linux
/dev/xvda2      7626750 20969471 13342722  6.4G  5 Extended
/dev/xvda5      7626752  9625599  1998848  976M 82 Linux swap / Solaris
/dev/xvda6      9627648 20969471 11341824  5.4G 83 Linux
 
Old 03-04-2024, 07:20 AM   #5
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,298
Blog Entries: 61

Rep: Reputation: Disabled
Ignore my post. I just saw sr0, didn't read the rest properly, and thought you wanted to add extra space to a DVD.
 
Old 03-04-2024, 07:51 AM   #6
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,298
Blog Entries: 61

Rep: Reputation: Disabled
You really need a bigger hard drive. 20GB isn't enough for most distros.
 
Old 03-04-2024, 08:02 AM   #7
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,796

Rep: Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201
Good joke anyway, "Your DVD is full".

Without LVM you can only grow the last partition. There is no simple solution.

But first, what happened to your xvda2? It overlaps with xvda5 and xvda6.
IMHO it should end at sector 7626751
Is it used at all?

Last edited by MadeInGermany; 03-04-2024 at 08:12 AM.
 
Old 03-04-2024, 08:09 AM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,710

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
It looks like the OP is running a Xen virtual machine.
You can not use fdisk to move partitions. I don't use Xen but I suppose you can boot a gparted ISO to move the extended partition to the end and resize xvda1. Create a backup first just in case.
 
Old 03-04-2024, 08:48 AM   #9
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,298
Blog Entries: 61

Rep: Reputation: Disabled
Quote:
Originally Posted by MadeInGermany View Post
Good joke anyway, "Your DVD is full".
Thanks. I've debugged my brain since I wrote that.
 
Old 03-04-2024, 09:48 AM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,710

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
xvda2 is an extended partition...
 
Old 03-04-2024, 09:58 AM   #11
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,855

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
Quote:
Originally Posted by michaelk View Post
xvda2 is an extended partition...
just to make it even more difficult. But anyway, OP can add a second disk, move /home onto it, remove all the extended partitions, including xvda2, resize root, move home back (but this time use a new primary partition) and finally create a new swap.
 
Old 03-04-2024, 04:13 PM   #12
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,519

Rep: Reputation: 2493Reputation: 2493Reputation: 2493Reputation: 2493Reputation: 2493Reputation: 2493Reputation: 2493Reputation: 2493Reputation: 2493Reputation: 2493Reputation: 2493
In addition to what has been suggested, you don't seem to have given much thought to this before doing it. A 10GB drive? What are you putting on it? Slitaz, TinyCore. If you look at the total sectors from the fdisk output, you can see that the drive is now double (20GB) what it was but you have done nothing with the partitions on the drive. As pointed out, xvda2 is an Extended partition containing xvda5 and xvda6. You could extend xvda6 to the end of the drive which would make you /home partition about 15GB. You need to have xvda5 and xvda6 unmounted and then extend xvda2 to the end of the drive and then extend xvda6 also to the end of the drive.

Since it is xvda1 that is full, this won't help but the same process would be needed. Unmount the logical partitions (do a backup if there is any meaningful data), extend xvda2 to the end of the drive and move the beginning of xvda5 and 6 to the end of the drive then move the beginning of xvda2 to the right. Sound like fun? Simplest would be to start over and if you have any data, first do a backup. You might consider using gpt rather than dos partition table.
 
Old 03-04-2024, 05:34 PM   #13
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,662
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
FYI: Regarding the larger issue, may I also point you to LVM = Logical Volume Manager, which is usually installed by default. (And, IMHO, definitely should be.)

This very important facility defines "the mount-points that you see and use" as "logical volumes" that are carved out of "storage pools" which can seamlessly span multiple physical devices. So, if you "run out of space," you install a new volume, add it to the "storage pool," and then expand the filesystem to recognize the new space. (You can expand a filesystem without downtime.)

LVM is a thoroughly-designed facility which also has effective solutions for problems such as: "ominous clicking noises." You can reliably move everything off of the failing drive, again without downtime.

Last edited by sundialsvcs; 03-04-2024 at 05:39 PM.
 
Old 03-04-2024, 05:47 PM   #14
rclark
Member
 
Registered: Jul 2008
Location: Montana USA
Distribution: KUbuntu, Fedora (KDE), PI OS
Posts: 482

Rep: Reputation: 179Reputation: 179
Quote:
LVM = Logical Volume Manager, which is usually installed by default. (And, IMHO, definitely should be.)
I disagree. Disks are large enough now that LVM really isn't needed -- for home use that is. LVM seems more geared to commercial use. I mean 1TB is now around $100. No excuse for small disks in the home environment IMHO. My OS drive is a 2TB SSD (formatted ext4) with only around 100GB used. As for VMs, I give a minimum of 50GB to each of them depending on what I use them for. Never had to care whether to 'expand' a VM disk which I think above OP must be using? Again no need for LVM... Not sure LVM would be useful in a VM anyway.

Last edited by rclark; 03-04-2024 at 05:49 PM.
 
Old 03-04-2024, 07:11 PM   #15
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,662
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
My point was never that "you might actually need to use it, these days," but simply that: "if you 'find yourself short,' you can."

And in quite a few(!) "cloud-based (virtual machine ...) client deployments," this (over time) turned out to be a major life-saver. Because real-world websites accumulate "database rows" and "downloaded images and such" with rather-frightening speed. You can very quickly purchase another "hunk of storage" from the vendor, and "put it online and keep running." (It's not my preferred way of doing things, but you gotta do what you gotta do.) The running system does not perceive the existence nor the boundaries of the "successive purchases."

Last edited by sundialsvcs; 03-04-2024 at 08:23 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
add extra tab space at the end of the row lakshana Linux - Newbie 4 03-21-2023 12:50 AM
SCSI controller - Add extra controller & add a disc to the extra controller raj100 Linux - Hardware 1 11-01-2015 11:30 AM
LVM - creating extra logical volumes (using extra space outside LVM) rhbegin Linux - Server 1 01-30-2013 07:08 PM
/var is out of space, need to add extra disk and need to maintain the data . neonate Linux - Server 1 05-21-2011 01:28 PM
add space to / when from spare space on disk ctsiow Linux - General 4 11-07-2007 07:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration