Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
anthonypants
May 6, 2007

by Nyc_Tattoo
Dinosaur Gum
I've got a couple of CentOS VMs with 10GB ext4 root partitions and I'd like to make those partitions larger. The catch is that they're using LVM and I'm not familiar with LVM at all. Am I really supposed to make a new partition at the end of the disk and assign it to the LVM disk?

Adbot
ADBOT LOVES YOU

RFC2324
Jun 7, 2012

http 418

anthonypants posted:

I've got a couple of CentOS VMs with 10GB ext4 root partitions and I'd like to make those partitions larger. The catch is that they're using LVM and I'm not familiar with LVM at all. Am I really supposed to make a new partition at the end of the disk and assign it to the LVM disk?

You could do that, but you can also expand the partition itself.

http://tldp.org/HOWTO/LVM-HOWTO/extendlv.html

Pretty sure extending it is the preferred way to do it.

Docjowles
Apr 9, 2009

You can also get memory stats via SNMP if all you want is like free/used/swap. Cacti can poll that out of the box and doesn't need to log in to your servers and run poo poo.

theperminator
Sep 16, 2009

by Smythe
Fun Shoe

RFC2324 posted:

You could do that, but you can also expand the partition itself.

http://tldp.org/HOWTO/LVM-HOWTO/extendlv.html

Pretty sure extending it is the preferred way to do it.

Yeah, Extending the underlying PV rather than creating a new partition, pvcreate etc etc is the preferred option however you have to resize the underlying partition first which is hairy and involves (I think! no warranty...)
1: Recommended: Dump the partition layout with sfdisk -d <device name> and saving for future reference if you cock it up
2: List partitions in fdisk
3: Delete Partition, recreate with the same start sector, end sector being the default value (end of disk)
4: Change type to 8e
5: Reboot, then do pvresize, lvextend

If you just add more partitions (and your disk is using MBR instead of GPT) you'll hit a limit of 5 (I think) partitions.

It's a bit scary at first, once you've done it 100 times without loving up you stress less.

anthonypants
May 6, 2007

by Nyc_Tattoo
Dinosaur Gum

RFC2324 posted:

You could do that, but you can also expand the partition itself.

http://tldp.org/HOWTO/LVM-HOWTO/extendlv.html

Pretty sure extending it is the preferred way to do it.
None of these ever mention ext4, and while I'm pretty sure there's not a huge difference between ext3 and ext4 I'd still like to see something recent enough to mention it. It looks like the process is:
1) Use fdisk to delete and recreate the /dev/sda# partition, assuming /dev/sd# is at the end of the disk, and ensuring that the new partition starts on the same cylinder as the original partition
2) Use pvresize to extend the LVM physical volume
3) Use lvextend to extend the LVM logical volume
4) Use resize2fs to extend the filesystem

theperminator posted:

Yeah, Extending the underlying PV rather than creating a new partition, pvcreate etc etc is the preferred option however you have to resize the underlying partition first which is hairy and involves (I think! no warranty...)
1: Recommended: Dump the partition layout with sfdisk -d <device name> and saving for future reference if you cock it up
2: List partitions in fdisk
3: Delete Partition, recreate with the same start sector, end sector being the default value (end of disk)
4: Change type to 8e
5: Reboot, then do pvresize, lvextend

If you just add more partitions (and your disk is using MBR instead of GPT) you'll hit a limit of 5 (I think) partitions.

It's a bit scary at first, once you've done it 100 times without loving up you stress less.
yeah, that

RFC2324
Jun 7, 2012

http 418

I've only done it with XFS, so can't help with the ext4, but I'm p sure ext4 extends ok.

This rather lacking guide might help, but I do feel like you should probably do backups before trying any of this.

http://www.systutorials.com/5621/extending-a-mounted-ext4-file-system-on-lvm-in-linux/

anthonypants
May 6, 2007

by Nyc_Tattoo
Dinosaur Gum

RFC2324 posted:

I've only done it with XFS, so can't help with the ext4, but I'm p sure ext4 extends ok.

This rather lacking guide might help, but I do feel like you should probably do backups before trying any of this.

http://www.systutorials.com/5621/extending-a-mounted-ext4-file-system-on-lvm-in-linux/
Yeah, most of them are like that, and while rewriting a partition table is potentially dangerous, creating a new partition and adding it to the lv group seems really clumsy.

Docjowles
Apr 9, 2009

I can't 100% swear that lvm + ext4 works, but I have done plenty of raw ext4 extensions with no issues.

anthonypants
May 6, 2007

by Nyc_Tattoo
Dinosaur Gum

Docjowles posted:

I can't 100% swear that lvm + ext4 works, but I have done plenty of raw ext4 extensions with no issues.
Good enough for me.

Magog
Jan 9, 2010

Docjowles posted:

I can't 100% swear that lvm + ext4 works, but I have done plenty of raw ext4 extensions with no issues.

I've done it, it worked just fine for me.

thebigcow
Jan 3, 2001

Bully!
Is there any reason you can't just make a backup, boot into gparted, click your way through it, and call it a day?

anthonypants
May 6, 2007

by Nyc_Tattoo
Dinosaur Gum

thebigcow posted:

Is there any reason you can't just make a backup, boot into gparted, click your way through it, and call it a day?
For starters it's a public-facing SFTP server and I'm absolutely not going to put X on it

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

nevermind

thebigcow
Jan 3, 2001

Bully!

anthonypants posted:

For starters it's a public-facing SFTP server and I'm absolutely not going to put X on it

Great news, Gparted is available as a live cd!

Any way you do this shouldn't involve a bunch of voodoo with fdisk. Check the publication date on any howto's that call for it.

xzzy
Mar 5, 2009

Isn't gparted just a frontend for parted?

Learn the cli version. :colbert:

anthonypants
May 6, 2007

by Nyc_Tattoo
Dinosaur Gum

xzzy posted:

Isn't gparted just a frontend for parted?

Learn the cli version. :colbert:
I think this is a good strategy, but I'm used to fdisk and they're MBR disks so I'm just going to use fdisk.

xzzy
Mar 5, 2009

I've been typing fdisk for so many years now it's the first thing I try too. But it just don't cut the mustard anymore given how large disks have grown.

ToxicFrog
Apr 26, 2008


xzzy posted:

Isn't gparted just a frontend for parted?

Learn the cli version. :colbert:

I've never gotten filesystem resizes to work with the command line version, so there's some sort of special sauce the X11 version has that plain parted lacks.


xzzy posted:

I've been typing fdisk for so many years now it's the first thing I try too. But it just don't cut the mustard anymore given how large disks have grown.

:confused: fdisk has supported GPT and large disks for years. I use it for all my partitioning.

code:
Command (m for help): p
Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 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: gpt
Disk identifier: 39383967-E93C-F747-90B5-156CCFFE9A7E

Device          Start        End    Sectors  Size Type
/dev/sda1        2048 3907012607 3907010560  1.8T Solaris /usr & Apple ZFS
/dev/sda9  3907012608 3907028991      16384    8M Solaris reserved 1

xzzy
Mar 5, 2009

Well so it does.. at least in actually modern distributions. We're still stuck on RHEL6 and the fdisk it provides flips out on gpt disks.

Maybe someday when we're allowed to move to RHEL7 I'll get to try it!

anthonypants
May 6, 2007

by Nyc_Tattoo
Dinosaur Gum
I was under the impression fdisk didn't support GPT disks and gdisk was a port or fork or whatever of fdisk that did support GPT

ToxicFrog
Apr 26, 2008


anthonypants posted:

I was under the impression fdisk didn't support GPT disks and gdisk was a port or fork or whatever of fdisk that did support GPT

That was the case in 2008(?) or something, but util-linux fdisk and GNU fdisk have both supported GPT since 2012-ish, IIRC.

theperminator
Sep 16, 2009

by Smythe
Fun Shoe

thebigcow posted:

Great news, Gparted is available as a live cd!

Any way you do this shouldn't involve a bunch of voodoo with fdisk. Check the publication date on any howto's that call for it.

Well unless you install x or waste time booting a production system from a CD, yeah it does need voodo.
Parted won't resize LVM partitions either, so I would be surprised if gparted did.

SurgicalOntologist
Jun 17, 2004

I'm locked out of MariaDB on a Synology NAS I administrate (I didn't set it up, for the record). I don't know the root password. MariaDB was installed for OwnCloud which no one uses, but the guy who set it up doesn't remember the db root password. I tried to follow these steps to reset the password but I get

code:
$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)
and according to ps mysqld is running.

I tried to uninstall MariaDB and reinstall it but Synology doesn't let me without uninstalling OwnCloud first. I tried to uninstall OwnCloud but I get prompted for the MariaDB password and can't continue without it. It's a catch-22.

Help?

anthonypants
May 6, 2007

by Nyc_Tattoo
Dinosaur Gum

SurgicalOntologist posted:

I'm locked out of MariaDB on a Synology NAS I administrate (I didn't set it up, for the record). I don't know the root password. MariaDB was installed for OwnCloud which no one uses, but the guy who set it up doesn't remember the db root password. I tried to follow these steps to reset the password but I get

code:
$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)
and according to ps mysqld is running.

I tried to uninstall MariaDB and reinstall it but Synology doesn't let me without uninstalling OwnCloud first. I tried to uninstall OwnCloud but I get prompted for the MariaDB password and can't continue without it. It's a catch-22.

Help?
Try mysql -u root -h 127.0.0.1, or whatever IP address MySQL is listening on.

SurgicalOntologist
Jun 17, 2004

Duh, OK, I can get a password prompt with -p 3306. But I'm still getting a password prompt, which I thought shouldn't happen with --skip-grant-tables. Only one mysqld process running and its mysqld_safe --skip-grant-tables --skip-networking.

RFC2324
Jun 7, 2012

http 418

thebigcow posted:

Any way you do this shouldn't involve a bunch of voodoo with fdisk.

TIL I'm a witch doctor

theperminator
Sep 16, 2009

by Smythe
Fun Shoe

SurgicalOntologist posted:

Duh, OK, I can get a password prompt with -p 3306. But I'm still getting a password prompt, which I thought shouldn't happen with --skip-grant-tables. Only one mysqld process running and its mysqld_safe --skip-grant-tables --skip-networking.

I think you need to run it as
mysql --skip-grant-tables rather than mysqld_safe

jre
Sep 2, 2011

To the cloud ?



SurgicalOntologist posted:

I'm locked out of MariaDB on a Synology NAS I administrate (I didn't set it up, for the record). I don't know the root password. MariaDB was installed for OwnCloud which no one uses, but the guy who set it up doesn't remember the db root password. I tried to follow these steps to reset the password but I get

code:
$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)
and according to ps mysqld is running.

I tried to uninstall MariaDB and reinstall it but Synology doesn't let me without uninstalling OwnCloud first. I tried to uninstall OwnCloud but I get prompted for the MariaDB password and can't continue without it. It's a catch-22.

Help?

Have you tried updating the my.cnf so you have
code:
[mysqld]
skip-grant-tables
And then just starting it with the normal command

SurgicalOntologist
Jun 17, 2004

Solved it. -p isn't port, so I don't know what happened there. But it seems like the & was the problem, I foregrounded the mysql session and some additional initialization messages appeared and then I could connect (in another terminal tab).

edmund745
Jun 5, 2010
I have a Linux-Richard-Stallman-open-source type question, mebbe somebody knows. I dunno jack about Linux.

I am attempting to write a CAD/CAM program myself, to make files and cut them on a CNC router/mill. This will be written in Visual Basic, and will use an Arduino as the hardware-to-PC interface using serial-over-USB. Partly I'm doing it just for fun.
The reasons for these choices is that I'm most familiar with the arduino boards and Visual Basic, and I prefer Visual Studio to every other IDE I've seen, except maybe the Borland one, which costs a bunch of money that's too expensive to buy just to dick with.

Visual Studio is currently free for hobbyists, but of course that wasn't always so. So what I am wondering is, if it would be possible to do this as a totally-open-source project on Linux?
(-note that this would not require a real-time type of Linux distro; it should work with any of them,,, and yea, I know the technical reason they say you need that, and you only need that if you use a "dumb" controller board-)

I could re-write the PC software in C++ for Linux, that wouldn't be an issue.
And I could use any of the cheapo STM32 ARM dev boards from China-land that are so cheap they're practically disposable.

What I'm wondering about specifically is the breakout board-to-PC hardware connection issue: is there still any open-source way left to do this?

USB all requires proprietary chips and drivers, does it not?
I already know that many USB things do work on Linux and Arduino boards are one of them, but that isn't really "open". Or is it?....

I could write the PC software to work over a serial port or a parallel port, but PCs now don't use hardware interrupts nowadays, do they? Or is it just Windows that got rid of that? I don't ever concern myself with PC motherboard low-level stuff.

My last three desktop PCs had neither a parallel port or a serial port on the mobo. You can get PCI-e slot cards for that, but there is still a driver involved in getting any PCI-e card to work.
Building my own PCI-e interface card (and driver!) is a nice idea but only a dream. Besides, I wanted to keep the hardware complexity and cost down, hence the Arduino use.

RFC2324
Jun 7, 2012

http 418

edmund745 posted:

I have a Linux-Richard-Stallman-open-source type question, mebbe somebody knows. I dunno jack about Linux.

I am attempting to write a CAD/CAM program myself, to make files and cut them on a CNC router/mill. This will be written in Visual Basic, and will use an Arduino as the hardware-to-PC interface using serial-over-USB. Partly I'm doing it just for fun.
The reasons for these choices is that I'm most familiar with the arduino boards and Visual Basic, and I prefer Visual Studio to every other IDE I've seen, except maybe the Borland one, which costs a bunch of money that's too expensive to buy just to dick with.

Visual Studio is currently free for hobbyists, but of course that wasn't always so. So what I am wondering is, if it would be possible to do this as a totally-open-source project on Linux?
(-note that this would not require a real-time type of Linux distro; it should work with any of them,,, and yea, I know the technical reason they say you need that, and you only need that if you use a "dumb" controller board-)

I could re-write the PC software in C++ for Linux, that wouldn't be an issue.
And I could use any of the cheapo STM32 ARM dev boards from China-land that are so cheap they're practically disposable.

What I'm wondering about specifically is the breakout board-to-PC hardware connection issue: is there still any open-source way left to do this?

USB all requires proprietary chips and drivers, does it not?
I already know that many USB things do work on Linux and Arduino boards are one of them, but that isn't really "open". Or is it?....

I could write the PC software to work over a serial port or a parallel port, but PCs now don't use hardware interrupts nowadays, do they? Or is it just Windows that got rid of that? I don't ever concern myself with PC motherboard low-level stuff.

My last three desktop PCs had neither a parallel port or a serial port on the mobo. You can get PCI-e slot cards for that, but there is still a driver involved in getting any PCI-e card to work.
Building my own PCI-e interface card (and driver!) is a nice idea but only a dream. Besides, I wanted to keep the hardware complexity and cost down, hence the Arduino use.

libusb is a thing you might want to look at. Pretty sure any chips are likely to be proprietary, but I could be wrong(and no one is likely to fab their own chips anyway, are they?)

http://libusb.org/

LochNessMonster
Feb 3, 2005

I need about three fitty


ToxicFrog posted:

That was the case in 2008(?) or something, but util-linux fdisk and GNU fdisk have both supported GPT since 2012-ish, IIRC.

fdisk supports gpt but it's deemed not stable enough. Gdisk is the preferred way of dealing with GPT partitions.

Not sure what the issues are, I just use gdisk.

ExcessBLarg!
Sep 1, 2001

edmund745 posted:

I have a Linux-Richard-Stallman-open-source type question,
Not sure what your actual question is, honestly it's kind of all over the map.

Also, RMS doesn't give a poo poo about hardware. He does care about firmware blobs, but the line is drawn between flash ROMs and mask ROMs. As far as I know he doesn't acknowledge that FPGAs exist.

edmund745 posted:

And I could use any of the cheapo STM32 ARM dev boards from China-land that are so cheap they're practically disposable.
I wouldn't go with a cheap Chinese ARM board for a first project. Go with an RPi or something, which is still cheap in a relative sense, but is very well documented and has a huge community.

edmund745 posted:

What I'm wondering about specifically is the breakout board-to-PC hardware connection issue: is there still any open-source way left to do this?
OK, so you have a PC and an Arduino (or whatever). You want to communicate with the Arduino (or whatever) over serial? Is the question, "are there 'open-source' USB-serial adapters?"

I think most USB-serial adapters use proprietary hardware chips and custom drivers, as there's not a generic "USB serial class" device driver. This is sometimes a sticking point for the open-hardware people, but if you're just purchasing an off-the-shelf cable you shouldn't really care about that. The most common ones (FTDI, PL2303, etc.) are supported by the Linux kernel. From a programming perspective they just appear as a serial device (/dev/ttyUSBx) on the host and you can interact with them as if they were hardware UARTs.

edmund745 posted:

I could write the PC software to work over a serial port or a parallel port, but PCs now don't use hardware interrupts nowadays, do they?
Of course they do, but what's the "hardware interrupt" requirement you have? What's the problem you're actually trying to solve?

edmund745 posted:

My last three desktop PCs had neither a parallel port or a serial port on the mobo.
Motherboards often still expose a hardware UART on a header somewhere and you can buy DB-9 brackets for them.

edmund745 posted:

You can get PCI-e slot cards for that, but there is still a driver involved in getting any PCI-e card to work.
There's a driver involved in getting a hardware UART to work in a modern operating system too.

I drive a BBW
Jun 2, 2008
Fun Shoe
So all this talk about fdisk has me confused. I had no idea there was a 2tb size limit on drives with fdisk, but I was able to create a single primary partition on a 3tb drive with no problem the other day? I set it up in a LVM pool along with a 1.5tb drive I had. What was odd was there were some differences in the options I had while creating the single partition on each drive. One was with the partition type, the smaller drive I used 8e, but the larger drive was a different number. The options when creating the primary partitions were also different, but don't remember what they were. Did I possibly screw something up by using fdisk instead of parted or gdisk? The guide I used to create the LVM is below.

This was on an Ubuntu 16.04 system.

http://www.htpcbeginner.com/setup-lvm-pool-hard-drive-ubuntu

ExcessBLarg!
Sep 1, 2001
fdisk may have defaulted to a GPT label since the disk was large. You can run "sudo sfdisk -d /dev/DISK" to see what's up.

ExcessBLarg!
Sep 1, 2001

LochNessMonster posted:

fdisk supports gpt but it's deemed not stable enough. Gdisk is the preferred way of dealing with GPT partitions.
Says who?

anthonypants
May 6, 2007

by Nyc_Tattoo
Dinosaur Gum

I drive a BBW posted:

So all this talk about fdisk has me confused. I had no idea there was a 2tb size limit on drives with fdisk, but I was able to create a single primary partition on a 3tb drive with no problem the other day? I set it up in a LVM pool along with a 1.5tb drive I had. What was odd was there were some differences in the options I had while creating the single partition on each drive. One was with the partition type, the smaller drive I used 8e, but the larger drive was a different number. The options when creating the primary partitions were also different, but don't remember what they were. Did I possibly screw something up by using fdisk instead of parted or gdisk? The guide I used to create the LVM is below.

This was on an Ubuntu 16.04 system.

http://www.htpcbeginner.com/setup-lvm-pool-hard-drive-ubuntu
MBR disks have a 2TB size limit, if you want more than that you'll have to convert/reformat your disk to GPT first.

ExcessBLarg!
Sep 1, 2001
You actually can fully partition a 3 TB disk (with 512 byte sectors) with MBR but it requires two partitions. MBR's limitations are that no partition can start on or after 2^32 sectors, and no partition can be larger than 2^32-1 sectors, but two 1.5 TB partitions will work. It's dangerous though as it also requires that operating systems use 64-bit integers for calculating sector offsets otherwise they'll overflow.

Just checked, util-linux fdisk 2.27.1, which ships with Ubuntu 16.04 LTS warns on startup if you use it on a disk larger than 2 TB but still defaults to a MBR label if the disk has no label. It won't let you create a partition that crosses the 2 TB boundary, though it's capable of modifying partition tables with one.

My guess is that the 3 TB disk came with a GPT label?

I drive a BBW
Jun 2, 2008
Fun Shoe
I just checked and the 3tb drive has a gpt label. I didn't give it that, so it either came with that label or when I used to have Ubuntu installed on that drive it gave it a gpt label.

Adbot
ADBOT LOVES YOU

LochNessMonster
Feb 3, 2005

I need about three fitty



Sander van Vugt did, in the RHCSA/RHCE certification book he wrote.

The book is 2 years old or so, so might not be true anymore.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply