LinuxQuestions.org
Review your favorite Linux distribution.
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 01-27-2019, 08:07 PM   #1
jeffchung
LQ Newbie
 
Registered: Nov 2018
Posts: 14

Rep: Reputation: Disabled
Unhappy Is there the way to extend filesystem with data protection?


Hi I'm Jeff
I'm managing CentOS 6,7 Server. The server have a Filesystem. It's not a LVM(just normal filesystem of partition).
If I want to extend the Filesystem's size, I have to delete it and make it again. But I want to extend the size without data lose.
Is there anyway to do that ?


* Information
- Server Type : VM (VMWARE EXSI 6.5)
- How to extend Volume : VMWARE DataStore Volume Extend
- Qustion : After I extend volume, How to extend Partition's capacity?

- Server configure
[root@bgsa-tst-t1903 home1]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)

[root@bgsa-tst-t1903 home1]# fdisk -l

Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 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 label type: dos
Disk identifier: 0x0009dc9d

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 41945087 20971520 83 Linux
/dev/sda2 41945088 201326591 79690752 83 Linux
/dev/sda3 201326592 209715199 4194304 82 Linux swap / Solaris

[root@bgsa-tst-t1903 home1]# df -hPT
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda1 xfs 20G 4.2G 16G 21% /
devtmpfs devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs tmpfs 1.9G 24K 1.9G 1% /dev/shm
tmpfs tmpfs 1.9G 183M 1.7G 10% /run
tmpfs tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda2 xfs 76G 2.6G 74G 4% /home1
tmpfs tmpfs 380M 0 380M 0% /run/user/1005
tmpfs tmpfs 380M 0 380M 0% /run/user/0


Goal : /dev/sda2 sizing up! 76G -> 100G

Welcome any advice.

Thanks.

Last edited by jeffchung; 01-27-2019 at 08:12 PM.
 
Old 01-27-2019, 08:19 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by jeffchung View Post
- Qustion : After I extend volume, How to extend Partition's capacity?
Reboot and the new size will be recognised. Not strictly required, but easiest/safest.
Then "man xfs_growfs".
 
1 members found this post helpful.
Old 01-27-2019, 08:45 PM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
The problem is that the sda3 swap partition immediately follows the 76G sda2 partition. You will need to delete the swap partition, then enlarge the sda2 partition and its xfs filesystem (leaving 4G for the swap partition), and create and format a new swap partition. Note that if your current /etc/fstab references the swap partition by its UUID or label, you should include that UUID or label when formatting the new swap partition. See the mkswap manpage for details.
 
1 members found this post helpful.
Old 01-27-2019, 08:52 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Well spotted - makes one wish LVM was in the mix ...
 
1 members found this post helpful.
Old 01-28-2019, 05:25 PM   #5
jeffchung
LQ Newbie
 
Registered: Nov 2018
Posts: 14

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by syg00 View Post
Well spotted - makes one wish LVM was in the mix ...
Thanks your reply.

If that is not LVM, Is it possible to use xfs_growfs? I have another server and have same situation. That server has ext4 filesystem and It's not a LVM.
I just want to resize my filesystem(not LVM) without delete and recreate.
 
Old 01-28-2019, 06:33 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
The xfs_growfs is not dependent on LVM - the problem is as stated in post #3; swap is in the way. You can only grow the filesystem if the partition is larger than the filesystem. However the partition must be contiguous space, not broken over segments.
resize2fs will similarly enlarge ext4 filesystems. See the manpage for both commands.
 
1 members found this post helpful.
Old 01-28-2019, 11:44 PM   #7
jeffchung
LQ Newbie
 
Registered: Nov 2018
Posts: 14

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by syg00 View Post
The xfs_growfs is not dependent on LVM - the problem is as stated in post #3; swap is in the way. You can only grow the filesystem if the partition is larger than the filesystem. However the partition must be contiguous space, not broken over segments.
resize2fs will similarly enlarge ext4 filesystems. See the manpage for both commands.
Thanks. I solved it. As you said, I deleted my swap partition and /dev/sda2. After then, I made a new partition(completed resizing).
Delete -> Make New Partition -> reboot -> resize2fs

I just worried about data lose but It didn't happen.
Good..
 
Old 01-29-2019, 02:48 AM   #8
l0f4r0
Member
 
Registered: Jul 2018
Location: Paris
Distribution: Debian
Posts: 900

Rep: Reputation: 290Reputation: 290Reputation: 290
Good. Can you consider marking your thread as [SOLVED] then please?
 
  


Reply

Tags
extending, linux, partitionsize



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
Is there a way to use the Free Space on Parted "Print Free" to extend root partition? Kenince Linux - Newbie 5 04-10-2017 05:31 PM
Extend Linux Partition (Extend LVM) osama.mansoor Linux - Newbie 5 11-27-2015 01:09 AM
Is there a way to identify filesystem ext3 data mode ? sheelraj Linux - Newbie 15 12-02-2008 08:18 AM
extend a logical voule with ext3 filesystem jhnsegers Red Hat 0 10-04-2004 02:56 AM
extend /home filesystem size rtmisa Linux - Newbie 6 10-10-2003 08:36 AM

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

All times are GMT -5. The time now is 10:32 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