Resize Home partition

General support questions
Post Reply
4bfox
Posts: 4
Joined: 2017/08/15 12:37:51

Resize Home partition

Post by 4bfox » 2017/08/15 14:16:29

Hi:

Longtime MS user (DOS/Windows 3.1 and up), trying to get CentOS to work on a Dell server, mainly because I refuse to be heldup again by MS.

Anyhow, I partitioned the 12Tb RAID pool into 3 partitions: /dev/mapper/cl-root /dev/mapper/cl-swap /dev/mapper/cl-home

Where I erred was giving all remaining space to "cl-home". Now I need an NTFS formatted partition for sharing Windows files via Samba. I've tried "unmounting" "cl-home", hoping to shrink the partition and make a new NTFS one, to no avail.

Am I better off just wiping this out and reinstalling, or is there a less painful method?

Thanks for your help.

dcrdev
Posts: 70
Joined: 2015/10/25 23:42:17

Re: Resize Home partition

Post by dcrdev » 2017/08/15 17:55:55

It depends on what filesystem you're using - if you went with xfs then you cannot shrink the partition without destroying it, if ext4 then it shouldn't be a problem. If you went with ext4 then it's literally a case of using resize2fs, else if you are using xfs you'd have to copy the contents elsewhere and then recreate the partition.

Irrespective of the above, I would recommend using LVM instead of RAIDing individual partitions, it makes resizing a lot easier. Also I would question why you need a NTFS partition if sharing via SAMBA, the filesystem doesn't really matter.

User avatar
TrevorH
Site Admin
Posts: 33220
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Resize Home partition

Post by TrevorH » 2017/08/15 19:36:17

You don't need NTFS to share via samba - samba uses any valid filesystem known to the *host* not the client. The client sees it as a remote filesystem and uses it even if it doesn't know the filesystem in use on the server.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

desertcat
Posts: 843
Joined: 2014/08/07 02:17:29
Location: Tucson, AZ

Re: Resize Home partition

Post by desertcat » 2017/08/15 23:15:57

4bfox wrote:Hi:

Longtime MS user (DOS/Windows 3.1 and up), trying to get CentOS to work on a Dell server, mainly because I refuse to be heldup again by MS.
:lol: What took you so long?!? I escaped M$'s evil clutches when Win '95 came out, and have not looked back. If you are use to DOS you'll quickly learn LINUX -- some differences but many similarities. If you remember Norton Commander download Midnight Commander (yum install mc from the CLI should do it) they are virtually identical. The only time I run Windows now is as a Virtual Machine to solve my sister's problems as she refuses to switch to Linux :( -- you can lead a horse to water, but you can't force it to drink. There are several good Virtual Machine programs out there. I've been using VMWare's VMPlayer --> VMWare in case you are interested. This way you can run Windows and Window's programs should you need to. I usually run my VM's in a dedicated Virtual Desktop (one of those other things you can't do in Windows unless you are now running Win 10).

Again, Welcome to CentOS and Linux!!

4bfox
Posts: 4
Joined: 2017/08/15 12:37:51

Re: Resize Home partition

Post by 4bfox » 2017/08/16 01:28:40

Thanks for the advice, I really didn't see why the filesystem would matter, but had to ask. This Samba thing is driving us (I have another guy helping remotely) nuts! We're both Windows guys, and not used to 'manually' doing things....

I used to be pretty proficient with DOS (but that was a LONG time ago), just need to mess around with this until we can get it to work. When we try to log into the Samba folder, it seems to be a permission issue.

And yes, desertcat I AM sick and tired of MS. I work part time for a couple of small school districts, and it's appalling how they have been ROBBED over the years for license fees. So I'm going through this sort of painful transition to a CentOS server. We're just sharing files with Windows/Mac clients right now, may add DHCP and DNS server functions later (if I can get this to go).

FWIW, I switched my "fast" PC at home to Linux Mint/Windows 7 Pro dual boot a couple years ago. I still use Win 7 Pro for Quickbooks and a couple other Windows apps I haven't switched over to Mint, but Mint is WAY faster, and I don't have to worry as much about getting whacked while browsing....

desertcat
Posts: 843
Joined: 2014/08/07 02:17:29
Location: Tucson, AZ

Re: Resize Home partition

Post by desertcat » 2017/08/16 13:38:07

4bfox wrote:Thanks for the advice, I really didn't see why the filesystem would matter, but had to ask. This Samba thing is driving us (I have another guy helping remotely) nuts! We're both Windows guys, and not used to 'manually' doing things....

I used to be pretty proficient with DOS (but that was a LONG time ago), just need to mess around with this until we can get it to work. When we try to log into the Samba folder, it seems to be a permission issue.

And yes, desertcat I AM sick and tired of MS. I work part time for a couple of small school districts, and it's appalling how they have been ROBBED over the years for license fees. So I'm going through this sort of painful transition to a CentOS server. We're just sharing files with Windows/Mac clients right now, may add DHCP and DNS server functions later (if I can get this to go).

FWIW, I switched my "fast" PC at home to Linux Mint/Windows 7 Pro dual boot a couple years ago. I still use Win 7 Pro for Quickbooks and a couple other Windows apps I haven't switched over to Mint, but Mint is WAY faster, and I don't have to worry as much about getting whacked while browsing....
quote="4bfox"]Thanks for the advice, I really didn't see why the filesystem would matter, but had to ask. This Samba thing is driving us (I have another guy helping remotely) nuts! We're both Windows guys, and not used to 'manually' doing things....

I used to be pretty proficient with DOS (but that was a LONG time ago), just need to mess around with this until we can get it to work. When we try to log into the Samba folder, it seems to be a permission issue.

And yes, desertcat I AM sick and tired of MS. I work part time for a couple of small school districts, and it's appalling how they have been ROBBED over the years for license fees. So I'm going through this sort of painful transition to a CentOS server. We're just sharing files with Windows/Mac clients right now, may add DHCP and DNS server functions later (if I can get this to go).

FWIW, I switched my "fast" PC at home to Linux Mint/Windows 7 Pro dual boot a couple years ago. I still use Win 7 Pro for Quickbooks and a couple other Windows apps I haven't switched over to Mint, but Mint is WAY faster, and I don't have to worry as much about getting whacked while browsing....[/quote]

The problem with "dual booting" something is that it is an either /or situation: You can either run Windows or Linux, but not both at the same time; with a VM you can run both at exactly the same time. My Sister insists on running Win 7; I run CentOS 7.3 Linux. When she blows up her machine (thankfully not as frequently as she use to) while I am still running CentOS, I open a Virtual Desktop, and fire up my Windows 7 VM, then I can try and figure out where she screwed up, or if her problem is likely hardware related. Since you are talking servers you probably have more than enough memory to run a single instance of Win 7 as a VM in Linux Mint (or CentOS 7). My current machine is a light duty Workstation w/ 32GB of RAM with a hexacore AMD processor. Most of the time I hardly ever need that much horsepower unless I am testing something for my buddy who has almost the exact same identical machine, thereby we can determine if a problem shows up if it is restricted "operator error", or if it is a general bug that affects both machines. I multi-task across the machine with several programs running... and occasionally several VM's running all at the same time. Win 10 is a GIANT resource hog -- I can run it and maybe one other VM at the same time, after which this machine can be brought to its knees. Win 7 is not as bad but you probably should have at least 16GB of RAM if you plan to run Win 7 as a VM and run it in the background in a Virtual Desktop environment.

If you ran DOS (I started in MS-DOS 3.1 --> MS-DOS 6.22 plus Win 3.1 and Win 3.11 WFW) you should not have to much problem with the Linux CLI. Midnight Commander will make your life a whole lot easier. The major difference is there is no A:\> and where DOS uses a \, UNIX and its offspring -- including Linux -- use a / . I never got use the UNIX prompt so I hacked BASH to output the entire path which I used ASCII text to color code then ending in a DOS-like />.

Unlike Windows, Linux treats EVERYTHING like a file system, including drives, partitions, directories, sub-directories... and files which is why the type of file system you choose matters. A generally safe all purpose fs to use is ext4 journaling file system which is better than ext3, and ext2. There are newer fs that are suppose to be better than ext4, some are a long ways to becoming mainstream, with the majority of kinks worked out, and other newer ones that not much is known about but show great promise. CentOS 7.4 (due out between next week and the12th of Sept. or shortly there after), I think has a new fs in it. ext4 is starting to show its age, but it is still an excellent general purpose fs to use. Alternately ask your local Linux Guru what they recommend. As to partitioning your HDD (or SSD), there are two approaches: Create a Custom Partition table assigning each partition x amount of space [ /boot, /, /home, /usr, /tmp, /var, ...], or you can allow the computer to do it for you with LVM, that supposedly allows the partition to grow or contract. I use a strict Custom Partitioning scheme, my buddy an old UNIX hand uses LVM. If you are running a server you might want to use a LVM system.

Depending on how much work you have invested installing CentOS my suggestion is to play around with it for the next few weeks and when CentOS 7.4 is released download the ISO then do a fresh install from the ground up. Generally go with the default options and since you plan to use this as a server, go with LVM, for your file system ext4 is a generally safe option, but ask a guru if there might be a better option. One final note: The DEFAULT GUI for Red Hat and its offspring is GNOME, my buddy and I can't stand GNOME, and prefer KDE. KDE is not installed by default, so if you would like to play around to determine if you are a KDE or GNOME type of person, you will need to install KDE. To install bring up a console, become /root and type yum group list and look for something called KDE Plasma Workspaces then issue yum group install "KDE Plasma Workspaces" and hit enter, and all the packages and dependencies needed to run KDE will be installed.

Final note: If you are setting up a network, unless you are familiar with networking protocol, you might want to find someone who is. I run a small network of 4 machines -- 3 comprise a intranet of a gateway behind which sit two computers (my workstation and a backup computer). The 4th machine is a stand alone test machine that will someday replace my existing gateway. I control all four from a single keyboard, and mouse. I have a Modem, a Router, and a Hub. The Intranet is set up using DNS static IP Addresses, the stand alone is set up with a DHCP. It can be a nightmare to remember what cable goes where, I have also color coded the cabling, and printed out a schematic. If all you have is a single machine use DHCP, and let your ISP worry about the connection. If you plan on using the machine as a home network server, depending on how may devices may be connected to it you might want to consider assigning each device a separate DNS Static IP address, this avoids a lot of bouncing around each time you reboot the machine ie each device has its own address, so if you have a problem it is much easier to troubleshoot.

Hope this helps. In some ways Linux today is a piece of cake to install and use -- you don't have to compile kernels, no longer get thrown into "rpm dependency hell" to install a package, etc., for the most part Linux "just works". Today the hardest part is choosing between a million options. If you get a bit bogged down, see if you can find a Linux Guru near where you live -- and there is bound to be one near you -- and have them come by and help you with the install.

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: Resize Home partition

Post by hunter86_bg » 2017/08/16 20:08:55

As a lot of writing happened here... I will skip reading or I will die before that.

If your samba is still giving you a hassle , here is a short howto:
1.Prepare the server for sharing (no you don't need that NTFS):

Code: Select all

yum install samba policycoreutils-{python,devel}
2.Enable the services needed:

Code: Select all

systemctl enable smb nmb
3.Add the relevant service to the firewalld:
For CentOS based on RHEL7.4:

Code: Select all

firewall-cmd --permanent --add-service=samba && firewall-cmd --reload
For CentOS based on RHEL7.0-7.2 (maybe 7.3):

Code: Select all

firewall-cmd --permanent --add-service={smb,nmb} && firewall-cmd --reload
4.Create your directory and prepare it:

Code: Select all

mkdir /samba
semanage fcontext -a -t samba_share_t "/samba(/.*)?"
restorecon -RFvv /samba
chmod 777 /samba
Note: All permissions will be processed by the smb daemon, so allow everybody via 777. Otherwise you need Identity Management (maybe an AD) with "inherit acls=yes" if you wish to controll it via the folder's permissions instead of the smb daemon.

5.Add a user that samba user will match to. No shell is needed.

Code: Select all

useradd -s /sbin/nologin jack
6.Edit the samba main config file:

Code: Select all

vim /etc/samba/smb.conf
Define your share:

Code: Select all

[share]
	comment = SAMBA SHARE
	path=/samba
	writable = no
	public = no
	browseable = no
	write list = jack
Note: Despite that the share is not "writable" , all users or groups (defined as @group) in the write list are allowed to write - others have read only permissions.Define your WORKGROUP also!

7.Test your configuration:

Code: Select all

testparm
8.Create your samba user that is mapped to the linux user created in step 5:

Code: Select all

smbpasswd -a jack && pdbedit -L | grep jack
9.Start your services:

Code: Select all

systemctl start smb nmb
10.Configure your linux client:

Code: Select all

yum install samba-client cifs-utils -y
11.Check what is exported to your user:

Code: Select all

smbclient -U jack -L //sambaserver.example.com 
Note: As the share was defined as "browseable=no" you won't see the "share" share.

12.Mount your share as "jack:

Code: Select all

mount -t cifs -o username=jack //sambaserver/share /mnt
13.Define your credential file for automount:

Code: Select all

cat /root/credentials
username=jack
password=pass
Define your fstab entry:

Code: Select all

//sambaserver.example.com/share /mnt cifs defaults,credentials=/root/credentials 0 0

Code: Select all

umount /mnt && mount /mnt && findmnt /mnt
14.If you wish every user to mount the share for himself (use the user with least privilages for the credentials file) change the fstab to:

Code: Select all

//sambaserver.example.com/share /mnt cifs defaults,multiuser,sec=ntlmssp,credentials=/root/credentials 0 0
15.Every user can access the share with his own privileges as:

Code: Select all

cifscreds add sambaserver.example.com

4bfox
Posts: 4
Joined: 2017/08/15 12:37:51

Re: Resize Home partition

Post by 4bfox » 2017/08/23 13:01:27

Thanks for the advice. I may have to beg one of you guys to remote into our server and "fix" this. I simply have not had time to figure this out while juggling all the other demands in my life. And I REALLY don't want to pay through the nose for Win Server 2013, plus all the license fees for clients...

User avatar
TrevorH
Site Admin
Posts: 33220
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Resize Home partition

Post by TrevorH » 2017/08/23 15:57:35

That would really not be recommended.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

4bfox
Posts: 4
Joined: 2017/08/15 12:37:51

Re: Resize Home partition

Post by 4bfox » 2017/08/25 12:10:47

-Sigh-...I know. Will try again when things slow down some....

Post Reply