RHEL 5 ethtool reports no link even though the link light is lit

I had an issue today setting up a new machine (HP DL380 G7, RHEL 5.5 x86_64) where ethtool wasn’t reporting a link on any of the NICs despite the actual physical link lights being lit up.

# ethtool eth1
Settings for eth1:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised auto-negotiation: Yes
        Speed: Unknown!
        Duplex: Half
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: g
        Wake-on: d
        Link detected: no

After a fair amount of hair pulling, I finally got it reporting correctly by setting the NICs to DHCP and trying to up them. Even though there was no DHCP server, just trying to up the interfaces got ethtool reporting correctly.

# cat /etc/sysconfig/network-scripts/ifcfg-eth1
# Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
DEVICE=eth1
BOOTPROTO=dhcp
HWADDR=<something>
ONBOOT=no
HOTPLUG=no
TYPE=Ethernet

# ifup eth1

Determining IP information for eth1... failed.

# ethtool eth1
Settings for eth1:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: g
        Wake-on: d
        Link detected: yes
Advertisements

Shrink ext3 Filesystem

Assume we have an ext3 filesystem on an LVM volume that is just way too big.

$ df -hlP /backups/
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-service_backup   99G   15G   79G  16% /backups

A 100 GB filesystem for 15 GB of data? That is way too big! Let’s shrink that down and reclaim some of that wasted space.

$ sudo /sbin/resize2fs -p /dev/VolGroup00/service_backup 25G
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/service_backup is mounted on /backups; on-line resizing required
On-line shrinking from 26214400 to 6553600 not supported.

Can’t shrink a mounted filesystem. No problem.

$ sudo umount /backups

$ sudo /sbin/resize2fs -p /dev/VolGroup00/service_backup 25G
resize2fs 1.39 (29-May-2006)
Please run 'e2fsck -f /dev/VolGroup00/service_backup' first.

Now I have to fsck? Ok, fine.

$ sudo e2fsck -f /dev/VolGroup00/service_backup
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/VolGroup00/service_backup: 37/13107200 files (5.4% non-contiguous), 4309966/26214400 blocks

$ sudo /sbin/resize2fs -p /dev/VolGroup00/service_backup 25G
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/VolGroup00/service_backup to 6553600 (4k) blocks.
Begin pass 2 (max = 2562078)
Relocating blocks             XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 3 (max = 800)
Scanning inode table          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 4 (max = 8)
Updating inode references     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/VolGroup00/service_backup is now 6553600 blocks long.

Ah, there we go. Let’s make sure we didn’t screw anything up.

$ sudo e2fsck -f /dev/VolGroup00/service_backup
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/VolGroup00/service_backup: 37/3276800 files (5.4% non-contiguous), 3997466/6553600 blocks

Good, no problems found. Now that the filesystem is right-sized, next we have to shrink the logical volume.

$ sudo lvresize -L 25G /dev/VolGroup00/service_backup
  WARNING: Reducing active logical volume to 25.00 GB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce service_backup? [y/n]: y
  Reducing logical volume service_backup to 25.00 GB
  Logical volume service_backup successfully resized

And, just because I’m paranoid, let’s fsck one more time.

$ sudo e2fsck -f /dev/VolGroup00/service_backup
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/VolGroup00/service_backup: 37/3276800 files (5.4% non-contiguous), 3997466/6553600 blocks

Just need to remount the filesystem and we’re done!

$ sudo mount /backups

$ df -hlP /backups/
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-service_backup   25G   15G  8.6G  64% /backups

Ta-da!