LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-12-2014, 11:29 AM   #1
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
expand the boundary of a partition using terminal commands.


hi, is there a way to boot a live-usb (which is having trouble launching the gui on this pc) and expand the boundary of this partition from the command-line:
Code:
schneidz@xbmc:~$ uname -a -m -p
Linux xbmc 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
schneidz@xbmc:~$ sudo fdisk -l /dev/sda

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 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: 0x580621eb

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     1026047      512000   83  Linux
/dev/sda2   *    37750784    37955583      102400    7  HPFS/NTFS/exFAT
/dev/sda3        37955584   312578047   137311232    7  HPFS/NTFS/exFAT
/dev/sda4         1026048    37750783    18362368   83  Linux

Partition table entries are not in disk order
schneidz@xbmc:~$ sudo fdisk -l /dev/sda4

Disk /dev/sda4: 18.8 GB, 18803064832 bytes
255 heads, 63 sectors/track, 2286 cylinders, total 36724736 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: 0x00000000

Disk /dev/sda4 doesn't contain a valid partition table
schneidz@xbmc:~$ sudo fdisk -l /dev/sda4

Disk /dev/sda4: 18.8 GB, 18803064832 bytes
255 heads, 63 sectors/track, 2286 cylinders, total 36724736 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: 0x00000000

Disk /dev/sda4 doesn't contain a valid partition table
schneidz@xbmc:~$ df -h
Filesystem                Size  Used Avail Use% Mounted on
/dev/sda4                 9.7G  4.7G  4.5G  51% /
none                      4.0K     0  4.0K   0% /sys/fs/cgroup
udev                      860M  4.0K  860M   1% /dev
tmpfs                     175M  940K  175M   1% /run
none                      5.0M     0  5.0M   0% /run/lock
none                      875M  4.0K  875M   1% /run/shm
none                      100M  4.0K  100M   1% /run/user
/dev/sda3                 131G  121G   11G  93% /media/win
schneidz@mom:media/stuff   95G   41G   50G  46% /home/schneidz/hyper
the sda4 partition was dd'd from a 10 gb image and now i would like for it to claim the whole space (18.8 gb).

normally i use gparted but thats a no-go from this busybox terminal.
 
Old 08-12-2014, 12:24 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
The "partition" sda4 already has the 18.8 GB space.

I suspect what you're asking is how to make the "filesystem" that is mounted from /dev/sda4 see the 18.8 GB instead of 10 GB.

That depends on the filesystem type.

Run "df -hP" and look at the line that has /dev/sda4 in the Filesystem column then look at the Mounted On column at the end of the line. That shows you what mountpoint directory the device is using. Assuming this is already in your /etc/fstab file you should be able to determine the filesystem type from that entry. (e.g. you should see something like ext2, ext3, ext4, reiserfs, btrfs, etc...) on same line as the device and mountpoint in fstab file.

For extending ext* filesystems its fairly simple and can be done on line. You just run the relevant resize command for the filesystem (e.g. resize2fs for ext2 or ext3 or resize4fs for ext4). You run that against the device name (e.g. resize4fs /dev/sda4).
For other filesystem types you'd have to lookup the command. Run "man -k resize" will find man pages with resize mentioned and you can see if any of those seem relevant to the type you're using.

The above of course assumes you're NOT using /dev/sda4 as part of a metadisk or LVM Volume group.
 
1 members found this post helpful.
Old 08-12-2014, 01:25 PM   #3
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Original Poster
Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
hmm, output seems the same:
Code:
schneidz@xbmc:~$ df -hP
Filesystem                Size  Used Avail Use% Mounted on
/dev/sda4                 9.7G  4.7G  4.5G  51% /
none                      4.0K     0  4.0K   0% /sys/fs/cgroup
udev                      860M  4.0K  860M   1% /dev
tmpfs                     175M  940K  175M   1% /run
none                      5.0M     0  5.0M   0% /run/lock
none                      875M  4.0K  875M   1% /run/shm
none                      100M  4.0K  100M   1% /run/user
/dev/sda3                 131G  121G   11G  93% /media/win
schneidz@mom:media/stuff   95G   41G   50G  46% /home/schneidz/hyper
schneidz@xbmc:~$ cat /etc/fstab
# /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/sdc1 during installation
UUID=d9788d9b-9612-4983-830d-3ca680e715fe /               ext2    errors=remount-ro 0       1
/dev/sda3	/media/win	ntfs	rw	0	2
schneidz@xbmc:~$ mount
/dev/sda4 on / type ext2 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
/dev/sda3 on /media/win type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)
rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
schneidz@mom:media/stuff on /home/schneidz/hyper type fuse.sshfs (rw,nosuid,nodev,user=schneidz)
but fstab seems not to list the partition... but running mount gives the filesystem info we need.

should i attempt a resuze on a running system (then i could just use gparted ?)

Last edited by schneidz; 08-12-2014 at 01:31 PM.
 
Old 08-12-2014, 02:07 PM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Actually the device IS in your fstab but is referenced by its unique ID rather than by its (current) name:
UUID=d9788d9b-9612-4983-830d-3ca680e715fe / ext2 errors=remount-ro 0 1

The reason for that is that on a reboot what is currently /dev/sda could become /dev/sdb, /dev/sdf, or some other name depending on order that particular disk is found in your system. (For a single disk system this isn't usually a problem.) The UUID is one way to insure it always mounts the same device as root (/). Another way is to label the device and use the label (which you don't need to do since you have the UUID setup already).

As you found "mount" shows you the actual device name rather than the UUID so you've confirmed that the one mounted as root (/) is /dev/sda4.

The resize2fs should be run on /dev/sda4 since it is ext2.

You do NOT need to do anything with gparted or fdisk. As I noted previously the "partition" itself already has the 18.8 GB space. The "filesystem" (ext2 in your case) is a layer on TOP of the "device" (/dev/sda4 in your case).

Note that you will not seen an increase to exactly 18.8 GB when you run df again. This is because:
a) The 18.8 shown in the partition isn't actually 18.8 - the calculation is using 1000 as a multiplier instead of 1024.
b) There is overhead in the filesystem layout.
You should however see a reasonably close amount (e.g. ~17 GB) after the resize.
 
Old 08-12-2014, 02:15 PM   #5
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Original Poster
Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
heres what i did:
Code:
schneidz@xbmc:~/boot/grub2$ sudo resize2fs /dev/sda4
resize2fs 1.42.9 (4-Feb-2014)
Filesystem at /dev/sda4 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/sda4 is now 4590592 blocks long.

schneidz@xbmc:~/boot/grub2$ df -h
Filesystem                Size  Used Avail Use% Mounted on
/dev/sda4                  18G  4.7G   12G  29% /
none                      4.0K     0  4.0K   0% /sys/fs/cgroup
udev                      860M  4.0K  860M   1% /dev
tmpfs                     175M  940K  175M   1% /run
none                      5.0M     0  5.0M   0% /run/lock
none                      875M  4.0K  875M   1% /run/shm
none                      100M  4.0K  100M   1% /run/user
/dev/sda3                 131G  121G   11G  93% /media/win
schneidz@mom:media/stuff   95G   41G   50G  46% /home/schneidz/hyper
/dev/sda1                 477M  109M  339M  25% /home/schneidz/boot
thanks for teaching me something new.

Last edited by schneidz; 08-12-2014 at 02:18 PM.
 
Old 08-12-2014, 03:31 PM   #6
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Glad I could help.

Please go to thread tools and mark this as resolved. It helps others find solutions more quickly in future.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Partition 1 does not end on cylinder boundary Arun_kumar_k Linux - Newbie 3 01-08-2012 07:30 AM
Partition 1 does not end on cylinder boundary.,why is this? cola Linux - Newbie 3 01-29-2010 07:32 AM
Terminal commands: how to create a directory in ext2 partition on flash drive gordon__1 Linux - Newbie 6 01-14-2008 10:57 PM
need partition to end on cylinder boundary Master of Reality Linux - General 5 02-03-2006 09:51 PM
Partition does not end on cylinder boundary snisheeth Linux - General 0 01-22-2004 07:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:24 PM.

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